简体   繁体   中英

php drop down menu generated from MySql used to generate date from different table

I am trying to pass a value from drop down menu that was generated from a table and selected by user. Ideally this value should go to next page where it will be used to select data from different table. This is what I have. But I can't figure out how to pick up this value on the other end through "$_POST[???] ? ANy help is appreciated. Thank you

    <?php require_once('Connections/results.php'); ?>
    <form action="results2.php" method="post">
    <?php 

        function dropdown($competitionid, $competitionname, $meets, $strOrderField, $strNameOrdinal, $strMethod="asc") {

       echo "<select name=\"$strNameOrdinal\">\n";
       echo "<option value=\"NULL\">Select one</option>\n";

       $strQuery = "SELECT * FROM meets ORDER BY date DESC";

       $rsrcResult = mysql_query($strQuery);

       while($arrayRow = mysql_fetch_assoc($rsrcResult)) {
          $strA = $arrayRow["competitionid"];
          $strB = $arrayRow["competitionname"];
          $strC = $arrayRow["date"];
          echo "<option value=\"$strA\">$strB $strC</option>\n";
       }

       echo "</select>";
    }

    ?>

    <p>Meets:<br />
    <?php dropdown(competition_id, location_name, location, location_name, location_name1); 

    ?>

     <p><input type="submit" /></p>
    </form>
<select name="dropdown">
<option value="$1">$1</option>
<option value="$2">$2</option>
<option value="$3">$3</option>
</select>

i'm not sure but maybe its this just give it a try

$_POST['dropdown'];

在您的示例中,post变量的名称为$strNameOrdinal的值,而该post变量的值为$strA (或NULL )。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM