What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Help again with php

Help again with php
Author: Message:
YottabyteWizard
Senior Member
****

Avatar

Posts: 709
Reputation: 23
37 / Male / Flag
Joined: Mar 2005
O.P. Help again with php
Sorry to bother you again guys... but I really need to have this working for tomorrow.

The options of a select box are gathered from a table of mysql. And when an option is selected, copy the value of it to a text input.

The query is saved into a variable, but I need to get a certain row information from it... and I don't know how. I already went to php.net and other websites, but cant find the answer.

I currently have this:

code:
<html><head>

<script language="javascript">

function select(id) {


document.forma.docname.value=

}

</script>

</head><body>
<?php
require ('connect.php');
?>
<form name="forma">
Medicamento: <br>
<select name="medica" size=5 onselect="(select(this))";>
<?php
$db['query'] = mysql_query('SELECT * FROM doctores');
while ($db['process'] = mysql_fetch_assoc($db['query'])) {
echo ('<option value="'.$db["process"]["id"].'">'.$db["process"]["nombre"].'</option>');
}
mysql_close();
?>
</select>
<input type=text style="width:100px;" name="docname"><br>
</form>
</body></html>

Obviously the javascript part wont work, im stuck there. Any ideas?

Any help will be greatly appreciated.
08-09-2007 08:21 AM
Profile E-Mail PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: Help again with php
If you are trying to get the value of the currently selected option from a Select box you need to use this

code:
getId('medica').options[getId('medica').selectedIndex].value;

function getId(id) { return document.getElementById(id); }
08-09-2007 01:36 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On