Please enable JavaScript to view this site.

Navigation: Advanced topics > Events > Sample events > Appearance

PHPrunner32x32     PHPRunner manual


Add a dropdown list box with specific values

Scroll Prev Next More

 

Add a dropdown list box with specific values.

 

For example, select a car make name from the dropdown list box, and make it so that only the data for the selected car make is displayed.

 

Insert PHP code snippet on the Page Designer screen to do so:

 

$str= "<select style='width: 150px; display: inline-block;' class='form-control' onchange=\"window.location.href=this.options[this.".
"selectedIndex].value;\"><option value=\"\">Please select</option>";
//select values from the database
$strSQL = "select Make from Cars";
$rs = db_query($strSQL);
while ($data = db_fetch_array($rs))
$str.="<option value='cars_list.php?q=(Make~equals~".
$data["Make"].")'>".$data["Make"]."</option>";
$str.="</select>";
echo $str;

 

Note: Change red values to match your project.

See also:

Insert code snippet

About Page Designer

Database API

 

Created with Help+Manual 7 and styled with Premium Pack Version 3 © by EC Software