Hi,
I'm having a strange problem with a website that I'm currently working on and I was hoping somebody here will be able to help me.
I have two PHP pages, the first one contains a form and the second one takes the fields entered in the initial form, displays them, and displays two buttons, one is Submit and the other is Edit. If the user chooses Edit, then the first PHP page with the form will appear with the fields already filled in from before.
To transfer data back and forth I'm using cookies and they work fine because I am able to take the values entered into the form in the initial page and display them on the second page. My problem arises when users press on the Edit button and wish to go back to edit their information.
For some reason, when the values stored in the cookies are more than just word, the fields (of the form) only display the first word in the sentence. So when I'm dealing with an Address field for example, the value displayed in the field will be the first word of the Address initially entered.
Here's an example of one of the fields in my form:
<tr><td>Address: </td><td><Input type = "text" name = "address" <?php if($_COOKIE['employee_sticky']=="yes"){echo "value = $address_sticky";}else{echo ' ';}?> size = "35" maxlength = "30"/></td></tr>
*$address_sticky has already been assigned the value from the corresponding cookie. For those of you wondering why "sticky", it's because I'm dealing with a "sticky form".
I'm using a variable called "employee_sticky" to let the form know if it needs to fill in the fields with values stored in cookies. So I know for a fact that the problem isn't with the cookies, because I am able to display the first word stored in the cookies. Also, if I echo the values in the cookies outside of the form I get the full sentence instead of just the first word.
Thanks in advance,
Omer
Values of fields and Cookies
Moderator: General Moderators
Re: Values of fields and Cookies
I think you need to enclose the value in quotation marks.