Page 1 of 1

How to reload the form

Posted: Tue Feb 20, 2007 11:39 pm
by chitrapu
i have a form in page1. When i click the submit button the page2 gets loaded.When i come back to page1 the form contents are getting lost. How can i retain then. :twisted: :twisted: :twisted: :twisted: :roll: 8) :?

Posted: Tue Feb 20, 2007 11:42 pm
by psychotomus
#1: store them in sessions
#2: use the same form page as the page processing the data then use something like value="<?=$_POST['email'] ?>

i am not so familiar with sessions

Posted: Tue Feb 20, 2007 11:46 pm
by chitrapu
i am not so familiar with sessions. Can u just give a small example

Posted: Tue Feb 20, 2007 11:47 pm
by Luke
never EVER use something like this:

Code: Select all

<?=$_POST['email'] ?>
Use something like this:

Code: Select all

<?php echo htmlentities($_POST['email']); ?>
Why? Short tags are not portable across hosts/servers (not supported in all configurations) and they are going to be dropped in PHP6 I've heard. Also, what if somebody posted something like
"><script>HAXXXORZZ!!</script>
with your solution, that would be executed. OUCH.