So, i need this.
I have a input button and, lets say, 2 checkboxes in a form.
Form is about ordering items.
Button - value-10 "Modern Pen"
Checkboxes - value-300 (checkbox1) label-"Galaxy S3"
and value-350 (checkbox2) label-"Galaxy S4"
When user makes calculation my script need to make the job and say:
"Dear user you have selected Modern Pen and Galaxy S4 and it costs 360€."
I have this code, and it tells Sum of all selected items (this 360€), but I cant print labels of forms. Can someone tell me the easiest way (with example) of how to use, lets say value="10,ModernPen" in one input button/checkbox or any other way of making it do what i want?
What can I do with this code to do what I need? This works, now I need improvement.
<form action='order.php' method='post'>
<label>
<input type='radio' name='Pen' value='10' id='Pen' />
Modern Pen</label>
<label>
<input type="checkbox" name="Phone[]" value="300" id="Phone" />
Galaxy S3</label>
<label>
<input type="checkbox" name="Phone[]" value="350" id="Phone" />
Galaxy S4</label>
<input type='submit' name='Submit' value="Calculate" />
</form>
<?php
$pen = $_POST['Pen'];
if (!empty($_POST['Phone'])) {
$Phone = 0;
foreach ($_POST['Phone'] as $value) {
$Phone += $value;
}
}
$sum = $pen + $Phone;
echo "You Ordered items cost is:<br />";
echo "<div style='clear:both'></div><div class='style'><h3> $sum €</h3></div>";
?>
Please? Any help?