I have a page with about 10 checkboxes, is there a way i can enter them into an array, then on a later page, separate them so my script can check the prices and then add it together?
If you need more info just ask.
Checkboxes!!
Moderator: General Moderators
Code: Select all
<input type="checkbox" name="arrayї]" value="whatever1">
<input type="checkbox" name="arrayї]" value="whatever2">
<input type="checkbox" name="arrayї]" value="whatever3">
<input type="checkbox" name="arrayї]" value="whatever4">
<input type="checkbox" name="arrayї]" value="whatever5">Code: Select all
<?php
foreach($_POST['array'] as $key => $value)
{
echo $key." => ".$value."<br />";
}
?>
Last edited by qads on Thu Sep 23, 2004 7:10 pm, edited 1 time in total.
-
AlbinoJellyfish
- Forum Commoner
- Posts: 76
- Joined: Sun Apr 04, 2004 7:39 pm
Code: Select all
<strong>Protocols:</strong>
<br>
<input name="arrayї]" type="checkbox" id="r2" value="r2">
R2
<input name="arrayї]" type="checkbox" id="gr303" value="gr303">
GR-303
<input name="arrayї]" type="checkbox" id="idsn" value="idsn">
IDSN-PRI
<input name="arrayї]" type="checkbox" id="v5" value="v5">
V5
<br>
<input name="arrayї]" type="checkbox" id="tr08" value="tr08">
TR08
<input name="arrayї]" type="checkbox" id="calea" value="calea">
CALEA
<input name="arrayї]" type="checkbox" id="ss7" value="ss7">NVM its $_POST
yes but
yes that is it but you don't need to use the word array you can use what ever you want as long as it is constant.
I would also name all the ID tags the same with out using the [] like the name tag that way you can use javascript and process the checkboxes as an array if need be.
I would also name all the ID tags the same with out using the [] like the name tag that way you can use javascript and process the checkboxes as an array if need be.
Tutorial Section: viewtopic.php?t=23586