Get selected value from one dropdown list to another? HELP!!!

Discussion in 'PHP' started by debian23, Jun 26, 2012.

  1. #1
    Hello guys and PHP Developers. I'm new to programming and have a small problem but i cant find solution. So the problem is that i have one page index.php and dropdown list, when i click the button ,,edit,, with method="post" and action="edit.php" im redirected to edit.php. On the edit.php i like to have the same dropdown list with selected value that i before selected on index.php.

    Please guys can anyone help me !?
     
    debian23, Jun 26, 2012 IP
  2. shubhamm

    shubhamm Member

    Messages:
    37
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    41
    #2
    send value of dropdown list using POST then grab it $_POST['var'] then echo it out in values
     
    shubhamm, Jun 26, 2012 IP
  3. Simple Boot

    Simple Boot Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Don't forget the SELECTED property.
     
    Simple Boot, Jun 26, 2012 IP
  4. eritrea1

    eritrea1 Active Member

    Messages:
    182
    Likes Received:
    9
    Best Answers:
    2
    Trophy Points:
    70
    #4
    
    
    <?php
      echo "<P>".$_POST['dropdown']."</p>";
    ?>
    <form action="change this to something.php" method="POST">
    <select name="dropdown">
      <option value="1">First</option>
      <option value="2">Second</option>
      <option value="3">Third</option>
    </select>
    <input type="Submit" name="Submit">
    </form>
    
    Code (markup):
    This is what you can use to get the values of select value, but the principles can be applied to other similar forms as well
     
    eritrea1, Jun 26, 2012 IP