R
R.G. Vervoort
I am using a javafunction (onclick in select) in which i am calling a
function in php (thats why i send this to both php and javascript
newsgroups).
in the onclick i call the function "Place_Selected" with the value from the
select (naam_keuze.value)
in the function the value becomes the $zoek_id and searches in the database
for the record with the id of $zoek_id
the naam_keuze.value does not give the value to $zoek_id
When i replace naam_keuze.value for a number (15) i works great.
WHAT AM I DOING WRONG?
This is my code
Function Place_Selected($zoek_id)
{
include("data.php");
$link=mysql_connect($db_host, $username, $password) or die("Database
error!");
mysql_select_db($database , $link)or die("Couldn't open $db:
".mysql_error());
$sql=mysql_query("SELECT * FROM specialismen WHERE id='$zoek_id'");
if ($sql)
{
while($blah2 = mysql_fetch_array($sql))
{
$newsid = $blah2['id'];
$sticky = $blah2['naam'];
}
}
return("document.form.achternaam.value='$sticky'");
}
<select id=naam_keuze size=1 name=keuze style=visibility:hidden
onchange=".Place_Selected('naam_keuze.value').";document.form.voornaam.value
=naam_keuze.value;>
<option value=0>Kies
$options
</select>
Thanks for suggestions
roy
function in php (thats why i send this to both php and javascript
newsgroups).
in the onclick i call the function "Place_Selected" with the value from the
select (naam_keuze.value)
in the function the value becomes the $zoek_id and searches in the database
for the record with the id of $zoek_id
the naam_keuze.value does not give the value to $zoek_id
When i replace naam_keuze.value for a number (15) i works great.
WHAT AM I DOING WRONG?
This is my code
Function Place_Selected($zoek_id)
{
include("data.php");
$link=mysql_connect($db_host, $username, $password) or die("Database
error!");
mysql_select_db($database , $link)or die("Couldn't open $db:
".mysql_error());
$sql=mysql_query("SELECT * FROM specialismen WHERE id='$zoek_id'");
if ($sql)
{
while($blah2 = mysql_fetch_array($sql))
{
$newsid = $blah2['id'];
$sticky = $blah2['naam'];
}
}
return("document.form.achternaam.value='$sticky'");
}
<select id=naam_keuze size=1 name=keuze style=visibility:hidden
onchange=".Place_Selected('naam_keuze.value').";document.form.voornaam.value
=naam_keuze.value;>
<option value=0>Kies
$options
</select>
Thanks for suggestions
roy