Hi,
I would like to check if a checkbox in my form is cheked before I send the form. The name of the checkbox is 'ok'. Problem is it wont work. Who can help me?
form action="<?php if ($ok == 1) {echo "databasewrite.php";} ?>"
Thanks in advance, Jack
hth, njm
Form looks like:
<form action="<?php if ($ok == False) {echo "writedatabase.php";} ?>" method="post" name="aangifte" id="aangifte"> <table width="633" border="0" align="left"> <tr> <td width="134"><span class="style8">Personal data </span></td> <td colspan="3" align="left" valign="top"><span class="style6"><strong>Number:</strong> <?php echo $row_Recordset1['Number']; ?><br> <?php echo $row_Recordset1['initials']; ?><?php echo $row_Recordset1['name']; ?><br> <?php echo $row_Recordset1['adress']; ?><br> <?php echo $row_Recordset1['ZIP']; ?> <?php echo $row_Recordset1['City']; ?><br> <strong>Tel.:</strong> <?php echo $row_Recordset1['telephone']; ?> <strong>E-mail:</strong> <?php echo $row_Recordset1['email']; ?> </span></td> </tr> <tr> <td colspan="4"><hr></td> </tr> <tr> <td><span class="style8">Quantity</span></td> <td width="144"><input name="quantity" type="text" id="quantity"></td> <td width="148"> </td> <td width="189"> </td> </tr> <tr> <td height="294" align="left" valign="top"> </td> <td colspan="3" align="left" valign="top"> <p> </p> <p> <input name="ok" type="checkbox" id="ok" value="checkbox"> <span class="style8">All checked! </span> </p> <p> <input type="submit" name="Submit" value="Submit"> <input type="submit" name="Submit2" value="Clear"> </p></td> </tr> </table> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p> </p> <p><br> </p> </form>
It looks like you want to perform some sort of validation, before sending the form? In which case, you'll need some client-side script, as the checkbox value will only be updated once the form has been submitted to the server.