Results 1 to 2 of 2

Thread: multiple drop down lists

  1. #1
    Join Date
    Aug 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question multiple drop down lists

    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.

    Here is an example of what i want (link below) the user is also emailed a copy

    http://www.dermalogica.com/SpeedMapp...on=US&region=B

    I have searched the web and come close but nothing does it right

    I would be extremely greatful if anyone could help!

    Thanks

  2. #2
    Join Date
    Aug 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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 Code:
    <?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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •