Please help for my code. I must admit that I don't know what I am doing as I am just learning how to use this application and so please bear with me. I am not sure if I can do it but I created a function such as below and I hope to hear from you soon as I really need to make this work. Thanks in advance.:
function grand_total()
{
$PersonTotal = $_POST['$number_select'] * 50;
$TableTotal = $_POST['$number_select'] * 500;
$GrandTotal1 = ($PersonTotal + $TableTotal);
return $GrandTotal1;
}
to post it to my textbox which has a code like below:
<label for="grandtotal">Grand Total: $</label>
<input name="GrandTotal" id="GrandTotal" type="text" maxlength="10" readonly="true" value="<?php echo grand_total($form['GrandTotal'])?>" />
<?php helper_error('GrandTotal'); ?>
but here is the whole code for my calculation just in case you need it. My form needs a checkbox to see how many people are attending by choosing the right number using the drop down list and multiply to 50 for my first checkbox and 550 for my second checkbox then post the total as soon as it choose the number of people to my GrandTotal textbox which is read-only. I really need your suggestion and help.
<label>
<input name="checkbox_person" type="checkbox" value="<?php echo $checkbox_person; ?>" checked
/>I wish to make reservations for
<select name="number_select" id="number_select" onchange="calculate()">
<?php foreach ($number_select as $select => $prompt):?>
<option value ="<?php echo $select; ?>"
<?php echo helper_selected($select == $form['number_select']);?>
onchange="<?php echo grand_total($form['GrandTotal'])?>">
<?php safeEcho($prompt);?>
</option>
<?php endforeach;?>
</select> person(s) at $50 per person.
</label>
<br />
<label>
<input name="checkbox_table" class="checkbox" type="checkbox" value=<?php echo $checkbox_table; ?>
/>I wish to make reservations for
<select name="number_select" id="number_select" onchange="calculate()" >
<?php foreach($number_select as $select =>$prompt) : ?>
<option value = "<?php echo $select; ?>"
<?php echo helper_selected($select == $form['number_select']); ?>
onclick="<?php echo grand_total($form['GrandTotal'])?>" >
<?php safeEcho($prompt); ?>
</option>
<?php endforeach;?>
</select>table(s) at $500 per person.
<?php helper_error('checkbox_table');?>
</label>
<br />
<label for="grandtotal">Grand Total: $</label>
<input name="GrandTotal" id="GrandTotal" type="text" maxlength="10" readonly="true" value="<?php echo grand_total($form['GrandTotal'])?>" />
<?php helper_error('GrandTotal'); ?>