Page 1 of 1

Hidden field problem

Posted: Thu Oct 13, 2005 3:05 am
by vigour
I have a textfield in a form and the name of the textfield is textfieldName4

If I type 'myroadname' in the textfield everything works fine. But if I type 'myroadname 2A' I only get 'myroadname' left when I recieve the value on the other page. Everything after the space seems to just dissapear. Here is the code that I use for sending the hidden field.

Code: Select all

echo'<input type="hidden" name="value5" value='.$_POST['textfieldName4'].'>';

Posted: Thu Oct 13, 2005 4:41 am
by Skittlewidth
The problem is that there are no quotes around the value in the hidden field:

Code: Select all

echo'<input type="hidden" name="value5" value='.$_POST['textfieldName4'].'>';
should be

Code: Select all

echo'<input type="hidden" name="value5" value="'.$_POST['textfieldName4'].'">';
See the double quotes after the = sign and before the final > sign as you have done correctly for the type attribute and the name attribute.