Code: Select all
#page1.html
<html>
<head>
</head>
<body>
<table border='0' width='50%' cellspacing='0' cellpadding='0' >
<form name=form1 method=post action="page2.php">
<tr>
<td><b>Skills set</b></td>
<td> </td>
<td>
<input type=checkbox name=scripts value='Java'>Java <br>
<br>
</td>
</tr>
<tr><td align=center >
<input type=submit value=Submit>
<input type=reset value=Reset></td></tr>
</form>
</table>
</body>
</html>Code: Select all
#page2.php
<?PHP
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if (isset($_POST['scripts'])) {
$cb = $_POST['scripts'];
print $cb;
}
else{
print "you have'nt checked anything!";
}
}
?>however, what if the checkboxes are dynamically generated with the same name? and we need to pass all the values that has been checked to the other page?
Code: Select all
<ipnut type=checkbox name=scripts value='Java'>
<input type=checkbox name=scripts value='CSS'>
<input type=checkbox name=scripts value='PHP'>
<input type=checkbox name=scripts value='HTML'>
<input type=checkbox name=scripts value='XML>