Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-10-2006, 05:49 PM   PM User | #1
jdimino
New Coder

 
Join Date: Dec 2005
Posts: 50
Thanks: 0
Thanked 0 Times in 0 Posts
jdimino is an unknown quantity at this point
Adding onchange code

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?
Thanks


<?PHP
@ $db = mysql_pconnect(localhost, xxxx_xxxx, xxx);
if (!$db) {
print "Failed to connect to the database. Please try again later.\n";
exit;
}
mysql_select_db(xxx_xxx);
$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>';

?>
jdimino is offline   Reply With Quote
Old 06-10-2006, 09:06 PM   PM User | #2
chump2877
Senior Coder

 
chump2877's Avatar
 
Join Date: Dec 2004
Location: the U.S. of freakin' A.
Posts: 2,530
Thanks: 15
Thanked 128 Times in 121 Posts
chump2877 is on a distinguished road
I dont't know if your javascript works, but this is how you include the event handler:

PHP Code:
print '<select name="Available_Images" onChange="search.value=this.options[this.selectedIndex].text;"><br>\n'
__________________
Regards, R.J.
chump2877 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:53 AM.


Advertisement
Log in to turn off these ads.