Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Multiple checkboxes with single add to cart button

New Here ,
Oct 07, 2009 Oct 07, 2009

Hi,

Does any one know how to php code a page where someone can choose multiple checkboxes and add them to a cart

and what type of database and tables should I have.One example is a choice of Pizza toppings.Thank you for your help.

TOPICS
Server side applications
565
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 08, 2009 Oct 08, 2009
LATEST

Hi,

How about this:

Put multiple checkboxes in your HTML form, like:

<input name="topping[]" type="checkbox"  value="cheese" />

<input name="topping[]" type="checkbox" value="pepperoni" />

<input name="topping[]" type="checkbox" value="perchutto" />

On the target page, you will have a $_PUT["topping"] variable, with the "cheese,pepperoni,perchutto" string value.

On your database, create a new field. Data type would be either VARCHAR or TINYTEXT depends on how many toppings you will have.

Put the "cheese,pepperoni,perchutto" string directly to that field.

When you need it, you can pull the string from the database and convert it to an array with explode function.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines