All,
I'm new @ programming with JavaScript. I have a form where a box must appear with the value of the select-field. I've had a script in html-format and it worked.
Now I want it to make dynamic with php and it doesn't work anymore.
Can anyone help me?
here's the code in the php-form:
<?
session_start();
?>
<head>
<title>Geschenk leden</title>
<link rel="stylesheet" type="text/css" href="style.css">
<script language="Javascript">
<!--
function GetValue(ViewId,FillId,Field,SelectId)
{
x = document.lidgeschenk.elements[Field].selectedIndex;
y = document.lidgeschenk.elements[Field].options[x].text
z = document.getElementById(SelectId).value
if (y > waarde){
document.getElementById(ViewId).style.display = 'block';
document.getElementById(FillId).value = z;
}
else{
document.getElementById(id).style.display = 'none';
}
}
-->
</script>
<style type="text/css">
.verborgen{
display:none;
font-size:11px;
padding:4px;
}
</style>
</head>
<body>
<form id="lidgeschenk" name="lidgeschenk" method="post" action="geschenk.php">
<table><tr><td>Lid</td><td><select name="lid" id="lid" onChange="GetValue('View','Keuze',this.name,'')">
<option></option>
<?php
include('connect.inc.php');
$lidid="SELECT * FROM leden ORDER BY anaam, vnaam";
$lidres=mysql_query($lidid) or die(mysql_error());
while ($rij=mysql_fetch_array($lidres)){
$idlid=$rij['id'];
$anaam=$rij['anaam'];
$vnaam=$rij['vnaam'];
echo"<option value=$idlid>$anaam $vnaam</option>";
}
?>
</select></td></tr>
<div id="View" class="verborgen"><tr><td></td><td><input type="text" id="Keuze" ></input></td></tr>
<tr><td colspan=2><input name="sublid" type="submit" id="sublid" value="Kies lid" /></td></tr>
</div></table></from>
</body></html>
Bookmarks