By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,276 Members | 1,951 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,276 IT Pros & Developers. It's quick & easy.

insert multiple option in the database

P: 1
how can i insert multiple option selected on a select box?
how can insert them in the database ?
3 Weeks Ago #1
Share this Question
Share on Google+
1 Reply


P: 5
We Can Store Multiple Select Options on an array and save the values to the database using comma-separated.

Expand|Select|Wrap|Line Numbers
  1. <label for="services">Select Services :</label>
  2.           <select id="sel_services" name="services[]" multiple="multiple">
  3.             <option value="engine-oil-change">Engine Oil Change</option>
  4.             <option value="ac-service">AC Service</option>
  5.             <option value="wheel-alignment">Wheel Alignment</option>
  6.             <option value="normal-service">Normal Service</option>
  7.             <option value="body-washing">Body Washing</option>
  8.           </select>
  9.  
processController.php

Expand|Select|Wrap|Line Numbers
  1. $service = implode(',', $_POST['services']);
2 Weeks Ago #2

Post your reply

Sign in to post your reply or Sign up for a free account.