I have a form with a <select> and i want to submit the form on the onchange event on this input.
Here is the code pls help.
[HTML]
<head>
..............
<script language="text/javascript"> <!-- test javascript function abc(){ document.getEle mentById('akten ').submit(); } //--> </script> </head>
<body>
<form action="" method="post" name="akten" id="akten">
<select name="nrAkt" size="1" onchange="abc() ">
[/HTML]
[PHP] <?php do { echo "<option value=\"".$row_ Akt['ainr']."\">".$row_ Akt['anr']."</option>"; } while($row_Akt = mysql_fetch_ass oc($Akt)); ?> </select> <input type="hidden" name="message" value="data" /> <input type="submit" name="submit" value="submit" /> </form> [/PHP]
and i make the test of the form send with the value of the input message
[PHP] <?php echo $_POST['message']; if($_POST['message']=="data"){ ?>[/PHP]
Seems like the onchage event doesnt work and i didn t understand why.
Here is the code pls help.
[HTML]
<head>
..............
<script language="text/javascript"> <!-- test javascript function abc(){ document.getEle mentById('akten ').submit(); } //--> </script> </head>
<body>
<form action="" method="post" name="akten" id="akten">
<select name="nrAkt" size="1" onchange="abc() ">
[/HTML]
[PHP] <?php do { echo "<option value=\"".$row_ Akt['ainr']."\">".$row_ Akt['anr']."</option>"; } while($row_Akt = mysql_fetch_ass oc($Akt)); ?> </select> <input type="hidden" name="message" value="data" /> <input type="submit" name="submit" value="submit" /> </form> [/PHP]
and i make the test of the form send with the value of the input message
[PHP] <?php echo $_POST['message']; if($_POST['message']=="data"){ ?>[/PHP]
Seems like the onchage event doesnt work and i didn t understand why.
Comment