How to reload the form

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
chitrapu
Forum Newbie
Posts: 23
Joined: Sun Jan 14, 2007 11:39 pm

How to reload the form

Post 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) :?
psychotomus
Forum Contributor
Posts: 487
Joined: Fri Jul 11, 2003 1:59 am

Post 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'] ?>
chitrapu
Forum Newbie
Posts: 23
Joined: Sun Jan 14, 2007 11:39 pm

i am not so familiar with sessions

Post by chitrapu »

i am not so familiar with sessions. Can u just give a small example
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post 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.
Post Reply