Canadian

  


 
     





Return to Previous Page











 

Passing Values in Multiple Forms

       Passing values in multiple Drop Menus:
       You will have to create multiple variables to capture values passed by each menu choice.

      <?php $cat = $colname_rsProducttype ?> // Value passed from the first form to second form Query
      <?php $part = $colname_rsPart ?> // Value passed from the second form to the third form Query

        You then create a hidden variable in the second Drop menu form in order to pass the value from the first form to the third form. This is what the second form would look like.

       <td><?php if ($totalRows_rsProducttype > 0) { // Show if recordset not empty ?>
         <form id="Selecttype" name="Selecttype" method="post" action="Search.php">
          <span class="style1">Select Product Type</span>
          <input name="category" type="hidden" id="category" value= "<?php print $cat?>" /> <br />
           <select name="producttype" class="style2" id="producttype" onchange="this.form.submit()">
             <option value="" selected> Pick a Product Type </option>
            <?php
    do {
    ?>
              <option value="<?php echo $row_rsProducttype['SubGroup']?>"
           <?php if ($row_rsProducttype['SubGroup'] == $part) {
             echo 'selected="selected"';
           } ?>><?php echo $row_rsProducttype['SubGroup']?></option>
             <?php
    } while ($row_rsProducttype = mysql_fetch_assoc($rsProducttype));
      $rows = mysql_num_rows($rsProducttype);
      if($rows > 0) {
         mysql_data_seek($rsProducttype, 0);
            $row_rsProducttype = mysql_fetch_assoc($rsProducttype);
      } ?> </select>
              <!-- <input name="Submittype" type="submit" id="Submittype" value="Submit" /> --> *Note*
         </form>
         <?php } // Show if recordset not empty ?></td>

      *Note*, this form has an optional submit button which is no longer required. If a browser was not Java enabled, this button could be left active. The form will function either way.