kreut Posted February 22, 2011 Share Posted February 22, 2011 Hello, I'm trying to create a sticky form using: <input name="assignment_name" type = "text" id="assignment_name" <?php if ($_POST && $errors) { echo "value =" . htmlentities($_POST['assignment_name'], ENT_COMPAT, 'UTF-8'); } else {echo "value = $assignment_name";} ?> /></text> It works if my assignment name is one word; if it's multiple words, it only produces the first word. Any thoughts would be appreciated. Thank you... Quote Link to comment https://forums.phpfreaks.com/topic/228490-nothing-after-a-space/ Share on other sites More sharing options...
PFMaBiSmAd Posted February 22, 2011 Share Posted February 22, 2011 Your HTML is invalid. You need quotes (either single or double) around the value = "...." attribute. Quote Link to comment https://forums.phpfreaks.com/topic/228490-nothing-after-a-space/#findComment-1178144 Share on other sites More sharing options...
PaulRyan Posted February 22, 2011 Share Posted February 22, 2011 Try the following <?PHP if (isSet($_POST) && $errors) { $assignment_name = htmlentities($_POST['assignment_name'], ENT_COMPAT, 'UTF-8'); } ?> <input name="assignment_name" type ="text" id="assignment_name" value="<?PHP echo $assignment_name;?>"> Regards, PaulRyan. Quote Link to comment https://forums.phpfreaks.com/topic/228490-nothing-after-a-space/#findComment-1178145 Share on other sites More sharing options...
kreut Posted February 22, 2011 Author Share Posted February 22, 2011 Thank you both! First, for telling me about the html error...and second to PaulRyan for showing me a much "cleaner" approach. Enjoy your days... Quote Link to comment https://forums.phpfreaks.com/topic/228490-nothing-after-a-space/#findComment-1178150 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.