View Full Version : multiple drop down lists
claireb85
08-28-2007, 12:12 PM
Hi everyone:)
I am new to php and just getting my head round it and was wondering if anyone could help.
I want to create a page with multiple drop down lists and depending what the user selects decides the page they will be taken to. Sorry i havent explained this too well.:confused:
Here is an example of what i want (link below) the user is also emailed a copy
http://www.dermalogica.com/SpeedMappingOnline/SpeedMap.aspx?refer=DERMA&location=US®ion=B
I have searched the web and come close but nothing does it right
I would be extremely greatful if anyone could help!
Thanks
claireb85
09-10-2007, 10:09 AM
Hi please could anyone help with my previous question.
I found this piece of code on another forum but dont really understand it. i know this is nearly doing what i want but instead of taking me to a different page it just goes to index.php
<?php
if(isset($_POST['post'])) {
if (($_POST['color'] == 'red') AND ($_POST['size'] == 'small')) {
header("Location: page1.html"); }
elseif (($_POST['color'] == 'blue') AND ($_POST['size'] == 'small')) {
header("Location: page2.html"); }
elseif (($_POST['color'] == 'green') AND ($_POST['size'] == 'small')) {
header("Location: page3.html"); }
elseif (($_POST['color'] == 'yellow') AND ($_POST['size'] == 'small')) {
header("Location: page4.html"); }
elseif (($_POST['color'] == 'red') AND ($_POST['size'] == 'medium')) {
header("Location: page5.html"); }
elseif (($_POST['color'] == 'blue') AND ($_POST['size'] == 'medium')) {
header("Location: page6.html"); }
elseif (($_POST['color'] == 'green') AND ($_POST['size'] == 'medium')) {
header("Location: page7.html"); }
elseif (($_POST['color'] == 'yellow') AND ($_POST['size'] == 'medium')) {
header("Location: page8.html"); }
elseif (($_POST['color'] == 'red') AND ($_POST['size'] == 'large')) {
header("Location: page9.html"); }
elseif (($_POST['color'] == 'blue') AND ($_POST['size'] == 'large')) {
header("Location: page10.html"); }
elseif (($_POST['color'] == 'green') AND ($_POST['size'] == 'large')) {
header("Location: page11.html"); }
elseif (($_POST['color'] == 'yellow') AND ($_POST['size'] == 'large')) {
header("Location: page12.html"); }
else { die("Error"); }
exit;
}
?>
<form method='post' action='index.php'>
<select name="color" size="1"><option>red</option><option>blue</option><option>green</option><option>yellow</option></select>
<br>
<select name="size" size="1"><option>small</option><option>medium</option><option>large</option></select>
<br>
<input type='submit' name='post' value='Press here to view the relevant page'>
</form>
I dont understand why the files are going in a header will they be placed in the header of index.php. I am really confused.
Again i would be extremely greatful if anyone could help
Thanks
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.