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.

Recommended Answers

All 2 Replies

<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.

Member Avatar for diafol

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.