0

Hello, I know this is a very elementary question but after reading and trying for over four hours I know I need help or some direction. All I am trying to do is select options from two drop down boxes and two different msql selects. The the drop down boxes populate fine from the database but I cannot show the data from the array which I would I would like posted on a separate page .The form actionto the test.php works but no no data up. Here is what I have.

Edited by diafol: This is a PHP question

2
Contributors
2
Replies
5
Views
3 Years
Discussion Span
Last Post by diafol
0
<form name="Test1" method="POST" action="test.php">
<?php


$qry_str="SELECT DISTINCT City FROM tbl_Restaurant";
error_warn(2,"main.php: Executing query: ".$qry_str);
try {
    $result = mysqli_query($link, $qry_str);
} catch (Exception $e) {
    error_warn(4,'Database Query: Caught exception: '.$e->getMessage());
};
if (mysqli_num_rows($result) >0) {
    $dropdown1 = '<select name="City">';
    error_warn(4,"Select returned ".mysqli_num_rows($result)." rows.");
    while ($row = $result->fetch_array(MYSQLI_BOTH)) {
        $dropdown1 .= '<option value="'.$row['City'].'">'.$row['City'].'</option>';
    };
    $dropdown1 .= "</select>";  
    /* free result set */
    mysqli_free_result($result);
    echo $dropdown1;
} else {
    error_warn(4,"Query returned nothing.");
};
?>
<input type="submit" value="submit">
</form>

When I try to post I get nothing except the word Array. Please assist if possible. It is appreciated. Five hours and no luck so any help is greatly appreciated.

Edited by diafol: Reformatted code

0

You only show the 'population' code. There's no mention of post variables or processing here. What do you want us to suggest?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.