Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

php menu display record selected

Engaged ,
Jul 30, 2013 Jul 30, 2013

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

TOPICS
Server side applications
687
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation