Jump to content

step by step form with hidden?


jwk811

Recommended Posts

i made a quick example of the problem im having. at step 5 i dont get the data for some reason. and its weird because when i resend the data it usually works by clicking refresh page. is very frustrating and makes no sense. please help

<?php
if(!isset($_GET['step'])){
?>

<form method="post" action="form.php?step=2">
<input type="text" name="text" id="text">
<input type="submit">
</form>

<?php
}
else if($_GET['step'] == 2){
?>

<form method="post" action="form.php?step=3">
<input type="hidden" name="text" id="text" value="<?php echo $_POST['text']; ?>">

<input type="text" name="text2" id="text2">
<input type="submit">
</form>

<?php
}
else if($_GET['step'] == 3){
?>

<form method="post" action="form.php?step=4">
<input type="hidden" name="text" id="text" value="<?php echo $_POST['text']; ?>">
<input type="hidden" name="text2" id="text2" value="<?php echo $_POST['text2']; ?>">

<input type="text" name="text3" id="text3">
<input type="submit">
</form>

<?php
}
else if($_GET['step'] == 4){
?>

<form method="post" action="form.php?step=5">
<input type="hidden" name="text" id="text" value="<?php echo $_POST['text']; ?>">
<input type="hidden" name="text2" id="text2" value="<?php echo $_POST['text2']; ?>">
<input type="hidden" name="text3" id="text3" value="<?php echo $_POST['text3']; ?>">

<input type="text" name="text4" id="text4">
<input type="submit">
</form>

<?php
}
else if($_GET['step'] == 5){

echo $_POST['text'];
echo $_POST['text2'];
echo $_POST['text3'];
echo $_POST['text4'];

}
?>

Link to comment
https://forums.phpfreaks.com/topic/235702-step-by-step-form-with-hidden/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.