Hi all, 
        I'm having some problem with my PHP script here. Do hope to receive some
help. I have written the script with a if..elseif..else ...condition to check if
my checkbox have been checked. There is 3 radio button to be clicked: eg button1
, button 2 and button3.Only one to be checked at one time. Supposely "button1"
is clicked, it should output "button1" as the selection once the submit button
has been clicked. I have attached my HTMl and PHP code below. Hope to get some
help here.

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="radio" name="payment" value="Cash" >Cash<br>
      </div>
      <div class="darker">
      <input ty<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>pe="radio" name="payment" value="Nets">Nets<br>
      </div>
      <div class="lighter">
      <input type="radio" name="payment" value="Cheque">Cheque<br></div><br>


PHP:


<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
                                                                               
                 
if ($payment==Cash AND $payment != Nets AND $payment != Cheque)
{
 echo ("Payment Mode:   Cash");
}
  elseif ($payment==Nets AND $payment != Cash AND $payment != Cheque )
  {
   echo ("Payment Mode:   Nets");
  }
}
  elseif ($payment==Cheque AND $payment != Nets AND $payment != Cheque)
  {
   echo ("Payment Mode:   Cheque");
  }
    else/* ($payment != Cash) AND ($payment != Nets) AND ($payment != Cheque)*/
    {
    echo ("Payment Mode:Cash Plus Cheque");
    }
    /* else
        {
           echo ("error!");
        }*/
 ?>
<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>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to