Hey guys, it's me again... I thought I was done; just real close.
I have a form that looks like this:
PHP Code:
$i=0;
while( $desertlist = mysql_fetch_array( $desertquery ) )
{
$desertCheckboxes .='<tr><td><font face="verdana" size="2" color="#000000"><input type="checkbox" name="DesertName['.$i.']" value="'
. $desertlist["DesertName"]
. '">'
. htmlspecialchars($desertlist["DesertName"])
. '</td>'
. '<td><font face="verdana" size="2" color="#000000"><input type="text" size="3" name="DesertSlices['.$i.']"></td>'
. '</tr>';
$i++;
}
echo ($desertCheckboxes);
Basically, if the user would like to add that particular "desert" to their order, they would first have to check the checkbox and then type in a qty. My problem comes in with user error. If the user does not check the checkbox, but enters a quantity, it is not going to show up on the summary page... they physically need to check that box!
Am I guessing javascript would allow me to create some sort of messaging system that would alert the user if they entered a quantity and did not check the box? Even better, is there a way to get around the checkboxes and just use qty textboxes?
The output looks like this:
PHP Code:
if(isset($_POST['DesertName'])){
echo '<tr><td bgcolor="#CCCCCC"><font size="3"><b>Desert Name</b></td><td bgcolor="#CCCCCC"><font size="3"><b>Slices</b></td></tr>';
$DesertName = $_POST['DesertName'];
$desertslices = $_POST['DesertSlices'];
foreach ($DesertName as $i=>$Desert)
{
echo '<tr>';
echo '<td><font size=3> ' . $Desert . '</td>';
echo '<td><font size=3> ' . $desertslices[$i] . '</td>';
echo '</tr>';
}
}
So basically, the check box selects the desert name, and the textbox enters a quantity. Nothing happens unless the box is checked. Could I activate the "DesertName" with just entering a value in the textbox?
Thanks guys!
Bookmarks