Forum Moderators: coopster
I have a php script with a variable that accepts a user's email address, does some stuff to it that then allows the variable to be used in a SQL query. I then need to use that email address on a later page to run a not dissimilar query. Rather than get the user to re-input the address, how can I simply hang onto the readily prepared variable for a new quey?
The address is in a cookie but when I pass the contents of the cookie into a new variable it is curiously formatted - someting like '\'email@example.com\ and is thus unusable.
I miss VB.
Cheers
Gary
$frm .= '<input type="text" name="some-name" value="' . $_SESSION['some-name'] . '">';
This is useful for error states, that is, user submits form without a required field, you can redirect (ugh) back to the form and have their data prepopulated. But in a successful submit, you don't want that to happen should they revisit the form, their first thought will be paranoia: "They are saving my personal info" - which is not really the case.
So when you're done with a session, clean up after yourself with session_destroy().