467,926 Members | 1,769 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,926 developers. It's quick & easy.

insert multiple option in the database

how can i insert multiple option selected on a select box?
how can insert them in the database ?
Feb 4 '20 #1
  • viewed: 1771
1 Reply
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>

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

Post your reply

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

Similar topics

7 posts views Thread by RotterdamStudents | last post: by
5 posts views Thread by afandi | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.