0

hi everyone
i need help in my query which is that:
1.which country name i selected from my dropdown list
2.when i select any country_name its show more info in new page.php like (this selected name show more information about country_name e.g. its captical, and cities through database in new page)

and here is my code:

<tr> <td>Country Name</td> <td> <select name="name"> <?php
      $conn = oci_connect("username", "pswrd", "db");
      $sql = 'SELECT name FROM country';
      $stid = oci_parse($conn, $sql);
      $success = oci_execute($stid);
      while ($row = oci_fetch_array($stid, OCI_RETURN_NULLS+OCI_ASSOC)) 
      {
        echo "<option value=\"countryname1\">" . $row['NAME'] . "</option>";
      }
    ?> 
2
Contributors
4
Replies
34
Views
4 Weeks
Discussion Span
Last Post by AndrisP
0

Select also ID of country.

<tr> <td>Country Name</td> <td> <select name="countryID"> <?php
      $conn = oci_connect("username", "pswrd", "db");
      $sql = 'SELECT id,name FROM country';
      $stid = oci_parse($conn, $sql);
      $success = oci_execute($stid);
      while ($row = oci_fetch_array($stid, OCI_RETURN_NULLS+OCI_ASSOC)) 
      {
        echo "<option value=\"" . $row['ID'] . "\">" . $row['NAME'] . "</option>";
      }
    ?>

Edited by AndrisP

0

i want to dispaly all data in new page.php which i was selected country name from dropdown list

0

e.g.

  1. i select country_name from dropdown list (AUSTRALIA)
  2. open new page.php ans its show like that
    country name: AUSTRALIA
    Capitical:
    City1: ____
    City2:

    City3:____
    these all information pick from oracle database table country_detail
0

You can select by country name but it is not good practice

    echo "<option value=\"".$row['NAME']."\">".$row['NAME']."</option>";

Edited by AndrisP

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.