View Full Version : Adding onchange code

06-10-2006, 05:49 PM
Hi Everyone,

I would like to add this code in the script bellow "ONCHANGE="search.value=this.options[this.selectedIndex].text"
I'm not sure how to handle this, can someone help me?

@ $db = mysql_pconnect(localhost, xxxx_xxxx, xxx);
if (!$db) {
print "Failed to connect to the database. Please try again later.\n";
$sql = "SELECT * FROM `seedling` ORDER BY `Available_Images` ASC";
if (!(@ $result = mysql_query($sql))) {
print "There was an error running your query:<p>\n". $sql . "<p>\n";
print '<select name="Available_Images"><br>\n';
print '<option value=""> Choose One ';
while ($row = mysql_fetch_row($result)) {
$id = $row[0];
$Available_Images = $row[24];

print "<option value=\"$id\"";
if ($_REQUEST["Available_Images"] == $id) { print " selected"; }
print "> $Available_Images <br>\n";
print '</select>';


06-10-2006, 09:06 PM
I dont't know if your javascript works, but this is how you include the event handler:

print '<select name="Available_Images" onChange="search.value=this.options[this.selectedIndex].text;"><br>\n';

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum