I have a form which consist of a multi-D array. It has both checkbox and text. So i would like to use both values to enter them in database. I could not figure out how to use them. Any help would be much appreciated. Here is my code ;
$clothes = array(
"For_Man"=>array("Suit", "Tie"),
"For_Woman"=>array("Skirt","Bra")
);
echo '<form action="" method="POST">';
foreach ($clothes as $cloth => $task) {
echo "<strong>{$cloth}</strong> <br />";
foreach ($task as $type){
echo "<input type=\"checkbox\" name=\"box[]\" value=\"{$type}\" />\r
{$type} <input type=\"textbox\" name=\"note[]\" size=\"2\" /><hr />\r";
}
}
echo "<input type=\"Submit\" name=\"submit\" value=\"Submit\" />\r
</form>";
if(isset($_POST['box'])){
if(isset($_POST['note'])){
$note = $_POST['note'];
}
$box = $_POST['box'];
}
So user can select the item and enter the amount they want so i can use it to enter database like
new_order = mysql_query("INSERT INTO orders(cloth_name, amount,... ) VALUES ('$box', '$note', ...........");