I currently have page logic which relys on the value tag of my checkbox. Want to send different data to my next page but doing so breaks code on my current page.
I want to send the ROW number not price. I thought to store the seat values into session data but I don't know how I can refer to the data in different columns when I can only have one value be bound to thecheckbox.
echo "input type='checkbox' name='check_list[]' value=\"$price;\";
to
echo "input type='checkbox' name='check_list[]' value=\"$seat;\";
breaks the total cost field below
foreach($res as $row) {
$seat = $row['RowNumber'];
$price = $row['Zone.PriceMultiplier * 15.00'];
echo "<tr>";
echo "<td>".$seat."</td>";
echo "<td>".$price."</td>";
echo "<td><input type='checkbox' name='check_list[]' value=\"$price;\" </td>";
echo "</tr>";
}
code for the text feild.
echo "<script> function calculateCheckbox() {
var el = document.getElementById('output');
var products = el.getElementsByTagName('input');
var len = products.length;
for (var i = 0; i < len; i++) {
if (products[i].type === 'checkbox') {
products[i].onclick = updateCost;
}
}
}
</script>";
echo "<script> function updateCost(e) {
var myForm = this.form;
var val = parseFloat(myForm.elements['total-cost'].value);
if (this.checked) {
val += parseFloat(this.value);
} else {
val -= parseFloat(this.value);
}
myForm.elements['total-cost'].value = val}
</script>";
I tried the non JS solution here but it didnt work.
HTML submit multiple values through one check box?
Do i need to use JS to get past this.