Page 1 of 1

PHP Hidden Variables?

Posted: Thu Sep 02, 2010 3:09 am
by gunter
Hey guys, Just a question about this form I have. At the moment, the form keeps the user data after submit has been clicked. Which is what I wanted. But can anyone show me how to go about having the code so that if the user refreshes the page, while in the middle of the form, the data stays in the form fields when the page is reloaded? I know there's a lot of threads about this, but none of the suggestions have worked. So if someone could show me that's be great.

Heres the code I have:

Code: Select all

<input name='name' type='text' class='form' value='<?php echo "" . (isset($_REQUEST['name'])) ? dataClean(ex_clean($_REQUEST['name'])) : FALSE . "";?> ' size="40" rows='5' />
The only reason I want to do this is because I have a captcha, and I need a way of this being refreshed if the user can't read it. So I thought this maybe the easiest way.

Any help appreciated :)

Re: PHP Hidden Variables?

Posted: Thu Sep 02, 2010 3:31 am
by requinix
A way to let the user refresh the page and keep everything intact as if the refresh hadn't happened? With JavaScript and some cookies, sure, but that's the extent of it.

PHP doesn't know what happens between one page request and another so if the person loads the page, types stuff, and refreshes without submitting then PHP won't know what they typed.