Jump to content

Select Box


j05hr

Recommended Posts

Hi,

 

I'm trying to make a 3 page registration form.

 

On the 3rd page I want it to echo back all the options they have selected.  I can get the input type to work but having problems with the selects.

 

First Page

<form action="choose.password.php" method="post">
eMail: <input type="text" name="eMail" /><br />
Forename: <input type="text" name="fname" /><br />
Surname: <input type="text" name="lname" /><br />
Date of Birth: <input type="text" name="dob" /><br />
Gender: <select name="gender">
<option value="male">Male</option>
<option value="female">Female</option>
</select>
<br />
I am not a lawyer: <input type="checkbox" name="lawyer" value="lawyer">
<br />
<br />
<input type="submit" value="Next" />

  
</form>

 

Second Page

<form action="confirm.details.php" method="post">
<p>email address: <?php echo $_POST["eMail"]; ?></p>
<p>password: <input type="password" name="eMail" /></p> 
<p>Confirm Password: <input type="password" name="eMail" /></p>
<p>Hint: <input type="text" name="hint" /></p>
<p>My email is correct, I am happy to be sent occassional emails, and i am not a family lawyer. <input type="checkbox" name="lawyer" value="lawyer"></p>
<input type="hidden" name="fname" value="<?php echo ($_POST["fname"]); ?>" />
<input type="hidden" name="eMail" value="<?php echo ($_POST["eMail"]); ?>" />
<input type="hidden" name="lname" value="<?php echo ($_POST["lname"]); ?>" />
<input type="hidden" name="dob" value="<?php echo ($_POST["dob"]); ?>" />
<select style="display:none;" name="gender" <?php echo ($_POST["gender"]); ?> />
<p><input type="submit" value="Next" /></p>

 

Third page

<p>Please confirm your details are correct to register.</p>
<p>Email Address: <?php echo $_POST["eMail"]; ?>
<p>Forename: <?php echo $_POST["fname"]; ?></p>
<p>Surname: <?php echo $_POST["lname"]; ?></p>
<p>Date of Birth: <?php echo $_POST["dob"]; ?></p>
<p>Gender: <?php echo $_POST["gender"]; ?></p>

 

How can I make the select work and echo it back on the third page?

 

Thanks

Link to comment
Share on other sites

Use an <input type=hidden field to store the value of the <option> from the select, just as you've done with the other fields, or store the value in a $_SESSION var. The way you're doing it now won't work because <select> tags have no value attribute.

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.