Skip to main content
Inspiring
July 30, 2013
Question

php menu display record selected

  • July 30, 2013
  • 0 replies
  • 687 views

i have a  menu displaying countries, each country has shops associated with it. when a country is selected i want the shops ( and there details to show below the menu )

i presume it will be an if statement

but not sure how

mysql_select_db($database_beau, $beau);

$query_rsStockists = "SELECT * FROM beauAW13_stockist, beauAW13_stockistLoc WHERE beauAW13_stockist.stockistLocID = beauAW13_stockistLoc.stockistLocID";

$rsStockists = mysql_query($query_rsStockists, $beau) or die(mysql_error());

$row_rsStockists = mysql_fetch_assoc($rsStockists);

$totalRows_rsStockists = mysql_num_rows($rsStockists);

mysql_select_db($database_beau, $beau);

$query_rsCountries = "SELECT * FROM beauAW13_stockistLoc";

$rsCountries = mysql_query($query_rsCountries, $beau) or die(mysql_error());

$row_rsCountries = mysql_fetch_assoc($rsCountries);

$totalRows_rsCountries = mysql_num_rows($rsCountries);

menu

  <form id="form1" name="form1" method="post" action="">

    <label for="select"></label>

    <select name="select" id="select">

      <?php

do { 

?>

      <option value="<?php echo $row_rsCountries['stockistLocID']?>"><?php echo $row_rsCountries['stockistLocName']?></option>

      <?php

} while ($row_rsCountries = mysql_fetch_assoc($rsCountries));

  $rows = mysql_num_rows($rsCountries);

  if($rows > 0) {

      mysql_data_seek($rsCountries, 0);

            $row_rsCountries = mysql_fetch_assoc($rsCountries);

  }

?>

    </select>

    <input type="submit" name="button" id="button" value="go" />

  </form>

and the shop details

  <p><?php echo $row_rsStockists['stockistName']; ?><br />

    <?php echo $row_rsStockists['stockistAdd1']; ?><br />

    <?php echo $row_rsStockists['stockistTown']; ?><br />

    <?php echo $row_rsStockists['stockistCounty']; ?><br />

    <?php echo $row_rsStockists['stockistCountry']; ?><br />

    <?php echo $row_rsStockists['stockistPostCode']; ?><br />

    <?php echo $row_rsStockists['stockistWWW']; ?></p>

thanks in advance

This topic has been closed for replies.