My form has a number of checkboxes depending on the number of records in a databases,once the user checks any of these boxes i want to be able to populate an array with the value check and afterward add to a table.
Is there anyway of using the onClick event without using java script ie call a PHP function onclick?
Im relatively new to PHP and would appreciate any help
Thanks
DI
onclick event/checkboxes
Moderator: General Moderators
php runs server-side. It's not aware of what's going on client-side until the next http-request is made.
but maybe this litte script gives you a hint
but maybe this litte script gives you a hint
Code: Select all
<html>
<head>
<title>checkbox test</title>
</head>
<body>
<fieldset><legend>paramters POSTed with this request</legend>
<pre><?php print_r(@$_POST); ?></pre>
</fieldset>
<form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="checkbox" name="chk[]" value="1" />
<input type="checkbox" name="chk[]" value="2" />
<input type="checkbox" name="chk[]" value="4" />
<input type="checkbox" name="chk[]" value="8" />
<br />
<input type="submit" />
</form>
</body>
</html>