Hi,
I'm actually quite confused by this issue.
I have two forms:
Form 1 is a registration form where a user may enter their details (e.g. first name and last name).
Form 2 is a 'review' page where the user can edit/confirm the details they entered in Form 1.
Once Form 1 is 'posted' I set SESSION variables equal to the 'posted' form field values.
In Form 2 I use the SESSION variable values to populate the fields. From here the user can edit their details.
However, when I try to edit a text field and append an additional string AFTER a whitespace the SESSION value is not updated. When I simply append a string without a whitespace, the SESSION value is updated.
For your information:
The SESSION values are re-assigned once Form 2 is 'posted'.
Each form field in Form 2 has a 'Value' equal to an appropriate SESSION variable.
Any suggestions?
Editing/re-assigning SESSION values
Moderator: General Moderators
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
An input/text element and no quotes around the value of the attribute value ?aceconcepts wrote:However, when I try to edit a text field and append an additional string AFTER a whitespace the SESSION value is not updated. When I simply append a string without a whitespace, the SESSION value is updated.
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
This is my text input element:
Code: Select all
echo "<input class=\"reg\" type=\"text\" name=\"aFirstName\" value=" . $_SESSION["dbFirstName"] . ">exactly, the browser get's it without quotes. Open your browser's source view. You will find something like
Code: Select all
<input class="reg" type="text" name="aFirstName" value=foo bar>You've added quotes for all other attributes but not for value.aceconcepts wrote:echo "<input class="reg" type="text" name="aFirstName" value=" . $_SESSION["dbFirstName"] . ">
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Code: Select all
echo '<input class="reg" type="text" name="aFirstName" value="', $_SESSION["dbFirstName"], '" />';Code: Select all
echo '<input class="reg" type="text" name="aFirstName" value="', htmlentities($_SESSION["dbFirstName"]), '" />';- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London