
July 12th, 2004, 06:38 AM
|
|
you know how we do
|
|
Join Date: Jun 2002
Location: In Tha IE -- San Bernardino COUNTY
Posts: 788
Time spent in forums: 2 h 4 m 2 sec
Reputation Power: 7
|
|
PHP Code:
<?php
if ($_SERVER["REQUEST_METHOD"]=='POST' && is_array($_POST['sendTo']) && count($_POST['sendTo'])>0) {
/* $key = the sendto ID, $value = on (will always be on if it is present */
foreach ($_POST['sendTo'] as $key => $value) {
printf("SendTo[%s] = %s\n<br>", $key, $value);
}
$sql = sprintf("UPDATE members SET sendTo=1 WHERE id in (%s);", join(', ', array_keys($_POST['sendTo'])));
print $sql;
}
?>
<html>
<head>
<title>Sample Sendto</title>
</head>
<body>
<form name="test" id="test" action="sendto.php" method="post">
0<input name="sendTo[0]" id="sendTo[0]" type="checkbox">
1<input name="sendTo[1]" id="sendTo[1]" type="checkbox">
2<input name="sendTo[2]" id="sendTo[2]" type="checkbox">
4<input name="sendTo[4]" id="sendTo[4]" type="checkbox">
8<input name="sendTo[8]" id="sendTo[8]" type="checkbox">
<br>
<input id="submitButton" type="submit" value="submit">
</form>
</body>
</html>
|