Jump to content

PHP display result in same page


wendyz

Recommended Posts

I wrote a PHP page connected database, there is a select option, I am trying to do is when I select one option, then it will access database and get result to be display on the same page.

 

print "<select style=\"font-family:Geneva, Arial, Helvetica, sans-serif; font-size:16px; font-weight:bold\" name=\"switchid\" id=\"switchid\" onchange=\"Change()\">";

print "<option name=\"ship\" value=\"Select\" selected>Select...</option>";

$sql="select * from xiaoping";

$result = mysql_query($sql);

while($row = mysql_fetch_array($result))

{

$company=$row['company'];

$city=$row['city'];

$zip=$row['zip'];

$state=$row['state'];

$add1=$row['address1'];

$add2=$row['address2'];

$id=$row['ID'];;

 

print "<option name=\"ship\" value=\"$id\">$company</option>";

 

}

mysql_free_result($result);

print "</select>";

 

above is select code, I can get data from database, then how can I display all result in the same page. And every time I change option, the different result will be displayed.

Link to comment
https://forums.phpfreaks.com/topic/153060-php-display-result-in-same-page/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.