how can i acces variables of 2nd last 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
bugthefixer
Forum Contributor
Posts: 118
Joined: Mon Mar 22, 2004 2:35 am

how can i acces variables of 2nd last form

Post by bugthefixer »

i have set register_globals to 'On' so i can acces all variables that were created in previous form in the current page but i cannot access any variable that was created beore the previous form i mean that was created before last page. right wt i m doin is i m creating a hidden type in each page and giving previous value as its current value and then using the hidden variable in next page.
wat i know is there exists some array but i dont know wat exactly that is..
can anybody tell me..
RadixDev
Forum Commoner
Posts: 66
Joined: Sun Mar 14, 2004 11:27 am
Location: U.K.

Post by RadixDev »

No need to turn register_globals On...

Say if you had a form like this:-

Code: Select all

<form method="POST" action="next.php">
  <input name="field1" id="field1" value="" type="text">
  <input value="submit" type="submit">
</form>
And in the next page...

Code: Select all

<form method="POST" action="next2.php">
  <input name="field2" id="field2" value="" type="text">
  <input name="field1" id="field1" value="<?php echo $_POST['field1'] ?>" type="hidden">
  <input value="submit" type="submit">
</form>
And in the next:-

Code: Select all

<form method="POST" action="next3.php">
  <input name="field3" id="field3" value="" type="text">
  <input name="field2" id="field2" value="<?php echo $_POST['field2']; ?>" type="hidden">
  <input name="field1" id="field1" value="<?php echo $_POST['field1']; ?>" type="hidden">
  <input value="submit" type="submit">
</form>
Although I would validate the sent data for any hacking attempts... just in case!
Post Reply