KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Is there an easy way to get the values of multiple checkboxes and store them in the database? <?php if(isset($_POST['go'])){ $fruit = $_POST['fruit'].","; echo $fruit; // if you selected apple and grapefruit it would display apple,grapefruit } ?> <form method="post"> Select your favorite fruit:<br /> <input type="checkbox" name="fruit" value="apple" id="apple" /><label for="apple">Apple</label><br /> <input type="checkbox" name="fruit" value="pinapple" id="pinapple" /><label for="pinapple">Pinapple</label><br /> <input type="checkbox" name="fruit" value="grapefruit" id="grapefruit" /><label for="grapefruit">Grapefruit</label><br /> <input type="submit" name="go" /> </form>
Tags (comma-separated)
Save Edits
Cancel