bullbreed Posted January 21, 2010 Share Posted January 21, 2010 I am calling a php function in the value of a form field to get a company name from the database. It works but the value returned in the form field is pushed over to the right. It seems as though this part of the PHP code (echo $session->userinfo['companyname'] is being included in the form field, but, it is invisible to the user. Company Name: <input type="text" name="companyname" maxlength="50" value=" <?php if($form->value("companyname") == ""){ echo $session->userinfo['companyname']; }else{ echo $form->value("companyname"); } ?> "> How weird is that. Any help would be greatly received. <?php echo $form->error("companyname"); ?></p> Quote Link to comment https://forums.phpfreaks.com/topic/189319-invisible-php-in-form-field/ Share on other sites More sharing options...
Catfish Posted January 21, 2010 Share Posted January 21, 2010 I think it's because there is a newline character and probably whitespaces before the <?php tag. The HTML source code will include these characters as they are not part of your php parsing. Quote Link to comment https://forums.phpfreaks.com/topic/189319-invisible-php-in-form-field/#findComment-999438 Share on other sites More sharing options...
bullbreed Posted January 21, 2010 Author Share Posted January 21, 2010 woooooooohoooooooooooo It worked. Your a star. :D :D :D Thanks You! Quote Link to comment https://forums.phpfreaks.com/topic/189319-invisible-php-in-form-field/#findComment-999448 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.