Jump to content

checkbox arrays


rachae1

Recommended Posts

Hi,

 

I am trying to put a form together for adding products to categories.

 

I currently have a textbox that allows me to add new categories with commas but I would also like to have checkboxes to let me choose any exiting categories that have already been entered into the database.

 

 

I am fairly new to arrays but I have managed to work out how to seperate the comma seperated text string.

 

<?php

<h4>Create a New Tag</h4>

<input class="input"  size="100"   type="text" id="tags" name="tags" />

//first insert the string into a variable
$tags = "$tags";
//execute the explode function
$str = explode(", ", $tags);

//output the keywords one by one using foreach
foreach ($str as $s)
{echo "$s"; };
?>

 

 

I just cant figure out how to display the array data in a checkbox and resubmit it back as well as entering a new category with the input box.

 

Can anyone point me in the right direction.

 

Link to comment
https://forums.phpfreaks.com/topic/123676-checkbox-arrays/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.