PDA

View Full Version : Store session variables?



Jack!
12-11-2013, 09:52 PM
Basically say if I had a basic register form, I.E:

Username
Password
Email

And say I wanted it so lets say they missed the email field, it would bounce them back to the page, but Username would still be there from when they first filled it in (Obviously wouldn't store the password until they register)

How can I go about doing it? Never tried it before.

Chippiewill
12-11-2013, 09:54 PM
Just load the same page again but include the variables in the form. I don't know how you've structured everything so I can't make a precise suggestion.

Jack!
12-11-2013, 09:57 PM
Just load the same page again but include the variables in the form. I don't know how you've structured everything so I can't make a precise suggestion.

Its not finished yet but this is what is there so far:
http://pastebin.com/bEdp4tsS

Chippiewill
12-11-2013, 10:07 PM
In that case I'd just make the form's action the same page as it's submitted from, then in each input tag add something like

value='<?php echo $_GET["name"]; ?>'

AaidenX
07-12-2013, 01:16 PM
Well

change $_GET/$_POST to the method you used for your form.

<input type='text' value='<?php echo $_POST['username']; ?>' name='username'>
<input type='text' value='<?php echo $_POST['email']; >?' name='email'>

etc, etc, simple? this is not a session variable.

Want to hide these adverts? Register an account for free!