Hi there. I am trying to figure out how to use a form to insert into mysql. One of the fields has the option of having one, two or three countries included. Example: "US,Canada,UK". So, the form has the option to choose which countries to include:
<input type="checkbox" name="country[]" value="USA">USA
<input type="checkbox" name="country[]" value="Canada">Canada
<input type="checkbox" name="country[]" value="UK">UK
In the 'country' field, I want to insert the countries based on which of the three checkboxes are checked. And this is where I am getting hung up. After reading a number of posts I am unclear as to if I should be looping through the checkboxes (I can't see why I would want to) or what I should be doing.
? php
if ($REQUEST_METHOD==POST) {
$insert = mysql_query("INSERT INTO sitelibrary
(id, title, url, country, notes)
VALUES
('','$title','$url', '$country','$notes')");
}
else {
}
?>
Please point me in the right direction ...