hi,

I was trying to create code that first fill drop-down list from table in db then when I select any value in this drop-down list then will get another

$res="SELECT * FROM users ";

$query = mysql_query($res);

while($row = mysql_fetch_assoc($query)) {

echo '<select size="name" name="D">

<option value="'.$row['name'].'">'.$row['name'].'</option>
</select>';

// <== i want to fill filed name from
// table users dir. because it always
// updating

echo''.$row['age'].';'.$row['address'].';'.$row['tel'].';

//then when i select any value from drop-list=name it auto will print
age ,addree & tel

}

?>

any one can help .

thank you in advanced

    you need to use ajax for this, so second dd is generated dynamically
    you find it easier to use the id of the member, as the value in the first dropdown

    size="name" << this line is wrong
    size should be a number but it's not needed in a dropdown

      Thank you cretaceous ...I am new in ajax dont know from where i have to start ?!

      and am wonder if there is php code that can solve problem like curl

        I think one mistake you're making is in understanding what PHP is and how it works.

        PHP is not run in the browser, it's all executed on the server, and creates the HTML, etc that the browser displays.

        Add a Javascript event handler to the select list that submits the form. The action attribute of the form is the PHP script that is run, using the values passed to it from the form that just got submitted.

        Also, the second point of your second post, what do you mean, "a problem like curl"? What is the specific problem you're having? Can you not make a cURL request, or do you not know how to in PHP?

          Write a Reply...