Page 1 of 1

how can i acces variables of 2nd last form

Posted: Tue Apr 13, 2004 11:15 pm
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..

Posted: Wed Apr 14, 2004 1:34 am
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!