Forum Moderators: coopster
textbox is for number of people attending only.
Database driven while loop, it produces checkboxes based on the amount of rows displayed
so, can it be done? (newbee)
SCRIPT type=text/javascript>
<!-- //get the price and total it.
//textbox function
function total() {
var people = choice("+ppl+");
if (people) {
people++
window.location = "sth goes here";
}
}
// checkbox function
function total() {
var buy = choice("+buy+");
if (buy) {
buy++
window.location = "sth goes here";
}
}
-->
</script>
php code:
<form id='people_attending'>
<input type='text' size = 1 maxlength= 3 name='ppl' onkeyup='checkField(this);'>
<form>";
..
..
..
while ( $row = mysql_fetch_array($result) )
{
echo "<tr>";
echo "<input type='hidden' name='id' value='".$row[tea_id]."'>";
echo "<tr><td width= 20% align=center><strong>".$row[tea_choice]."</strong></td></tr>".
"<tr><td width = 70% align=center>".$row[tea_desc]."</td></tr>"."<tr>"."  \$".
"<td align=center>".$row[tea_price]."</td></tr>";
echo <tr><td align=center><input type='checkbox' value='buy' action='javascript:total(<? echo '.$row['tea_price']'; ?>)"/>'."</td></tr>";
}//while
echo "</tr>";
echo "</form></table></center>";
[edited by: eelixduppy at 2:59 pm (utc) on Sep. 9, 2009]
[edit reason] disabled smileys [/edit]
You can use on function to grab the current number of people and multiply that by the price selected, it's not really clear what you are trying doing with that total though.