Hi all,
May I just ask how do I do a "if..elseif..else" condition to check if a
"checkbox" have been checked. For some reference, I have attached my HTML code
and PHP code below:
HTML:
<html>
<head>
<title>Payment Mode</title>
<style type="text/css">
@import url(receipt.css);
</style>
</head>
<body>
<form action="checkbox.php" method="get">
<br><br><br>
<div id="pagecontent1">
<div class="sectionheading">
Payment Mode:<br>
</div>
<div class="lighter">
<input type="checkbox" name="Cash" value="Cash" >Cash<br>
</div>
<div class="darker">
<input type="checkbox" name="Nets" value="Nets">Nets<br>
</div>
<div class="lighter">
<input type="checkbox" name="Cheque" value="Cheque">Cheque<br></div><br>
<div class="sectionheading">
*For Cheque plus Cash payment only:
</div>
<div class="lighter">
Cheque: $ <input name="cheque" type="text" size="6" maxlength="6"><br>
</div>
<div class="darker">
Cash: $ <input name="cash" type="text" size="6" maxlength="6"><br></div><br>
<input type="submit" name="submit" value="submit" align="center">
</div>
</form>
</form>
</body></html>
PHP Code:
<HTML>
<HEAD>
<title>Payment Mode</title>
<style type="text/css">
@import url(receipt.css);
</style>
</HEAD>
<BODY>
<br><br>
<div id="pagecontent1">
<div class="sectionheading">
<br>
<tr>
<td valign="top" class="darker" width="200">
<?php
}
?>
<?php echo "Payment Mode:Cash Plus Cheque"; ?>
<br>
</div>
</td>
Cash: <?php echo "$$_GET[cheque]";?><BR>
Cheque:<?php echo "$$_GET[cash]";?><BR>
<br>
<?php
$total = $_GET[cheque] + $_GET[cash];
$total=number_format($total, 2, ".", " ");
echo "<BR>Total payable: $$total<BR><BR>";
?>
</div>
</BODY>
</HTML>
Regards,
Irin.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php