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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.