wmguk Posted August 23, 2007 Share Posted August 23, 2007 Hey, I have a database and i create a record with $login = "carter n" when i go to edit, it sets $login = "carter" and drops the "n".. how can i stop this happening, while allowing the use of the space? any thoughts? Quote Link to comment https://forums.phpfreaks.com/topic/66328-solved-why-wont-my-form-pass-a-space/ Share on other sites More sharing options...
wmguk Posted August 23, 2007 Author Share Posted August 23, 2007 can i do something with %20 so it knows to enter it? Quote Link to comment https://forums.phpfreaks.com/topic/66328-solved-why-wont-my-form-pass-a-space/#findComment-331838 Share on other sites More sharing options...
MadTechie Posted August 23, 2007 Share Posted August 23, 2007 use $field = urldecode($_GET['field']); to resolve the encoding issule urldecode or use post Quote Link to comment https://forums.phpfreaks.com/topic/66328-solved-why-wont-my-form-pass-a-space/#findComment-331840 Share on other sites More sharing options...
wmguk Posted August 23, 2007 Author Share Posted August 23, 2007 hmm, i changed it to post, but its still not right, still not passing the space? any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/66328-solved-why-wont-my-form-pass-a-space/#findComment-331861 Share on other sites More sharing options...
MadTechie Posted August 23, 2007 Share Posted August 23, 2007 post some code so i can see what your doing Quote Link to comment https://forums.phpfreaks.com/topic/66328-solved-why-wont-my-form-pass-a-space/#findComment-331868 Share on other sites More sharing options...
wmguk Posted August 23, 2007 Author Share Posted August 23, 2007 <?php echo "<td width='30'><form name='editdetails' action='editpage/"; echo "$editpage" ; echo "' method='POST'><input type='hidden' name='login' value=" . $row['login'] . "><input type='submit' class='main' name='Submit' value='Edit' /></form></td>"; ?> then in the top of the page pulling the info out <?php $login = $_POST['login'] ; ?> Quote Link to comment https://forums.phpfreaks.com/topic/66328-solved-why-wont-my-form-pass-a-space/#findComment-331880 Share on other sites More sharing options...
MadTechie Posted August 23, 2007 Share Posted August 23, 2007 try this <?php echo "<td width='30'><form name='editdetails' action='editpage/"; echo "$editpage" ; echo "' method='POST'><input type='hidden' name='login' value='" . $row['login'] . "'><input type='submit' class='main' name='Submit' value='Edit' /></form></td>"; ?> you need the quote the value Quote Link to comment https://forums.phpfreaks.com/topic/66328-solved-why-wont-my-form-pass-a-space/#findComment-331885 Share on other sites More sharing options...
wmguk Posted August 23, 2007 Author Share Posted August 23, 2007 as per normal, excellent response thank you Why did it work for everything, is it just because php is clever and trys to help you out? Quote Link to comment https://forums.phpfreaks.com/topic/66328-solved-why-wont-my-form-pass-a-space/#findComment-332021 Share on other sites More sharing options...
MadTechie Posted August 23, 2007 Share Posted August 23, 2007 it works like this (from IE) example 1 <input type='hidden' name='login' value=hello> Works example 2 <input type='hidden' value=hello name='login'> Works example 3 <input type='hidden' value=hello world name='login'> technically it still works.. if you look back at example 2 it sends "hello" not "hello name=" so to tell the form its sending the correct data you enclose it in quotes.. like this <input type='hidden' value='hello world' name='login'> as a side note i don't think the examples above will work in firefox but will in IE also all of these were untested.. Quote Link to comment https://forums.phpfreaks.com/topic/66328-solved-why-wont-my-form-pass-a-space/#findComment-332113 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.