Jak wstawić wiele wybranych
<?php
// Make a MySQL Connection
mysql_connect("HOST_NAME", "USERNAME", "PASSWORD") or die(mysql_error());
mysql_select_db("DB_NAME") or die(mysql_error());
$checkBox = implode(',', $_POST['Colors']);
if(isset($_POST['submit']))
{
$query="INSERT INTO clr_tbl (colors) VALUES ('" . $checkBox . "')";
mysql_query($query) or die (mysql_error() );
echo "Complete";
}
?>
<html>
<body>
<form method="post" action="">
<input type="checkbox" name="Colors[]" value="Red">Red<br>
<input type="checkbox" name="Colors[]" value="Blue">Blue<br>
<input type="checkbox" name="Colors[]" value="Pink">Pink<br>
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>
Rht