Jump to content
Larry Ullman's Book Forums

ssh1375

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by ssh1375

  1. what is diferrent between these 2 ?

     

    look at  curly braces.

     

    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>Untitled Document</title>
    </head>
     
    <body>
    <form method="post" action="cal.php">
    <fieldset><legend>The Cost</legend>
    <table>
    <tr><td>quantity</td><td><input type="text" name="quantity"  /></td></tr>
    <tr><td>price</td><td><input type="text" name="price" /></td></tr>
    <tr><td>Tax</td><td><input type="text" name="tax" /></td></tr>
    <tr><td colspan="2"><input type="submit" name="submit" /></td></tr>
    </table>
    <input type="hidden" name="submitted" value="1" />
     
    </fieldset>
     
     
     
    </form>
    <?php
    if(isset($_POST['submitted'])){
    if (is_numeric($_POST['quantity']) and is_numeric($_POST['price']) and is_numeric($_POST['tax']))
    $total=($_POST['quantity']*$_POST['price']);
    $taxrate=( $_POST['tax'] / 100 );
    $tax2=($taxrate*$total);
    $end=($tax2+$total);echo $end;}
     
    else
    echo "!! fill it again";
     
     
     
    ?>
    </body>
    </html>
     
     
     
    <!doctype html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>Untitled Document</title>
    </head>
     
    <body>
    <form method="post" action="cal.php">
    <fieldset><legend>The Cost</legend>
    <table>
    <tr><td>quantity</td><td><input type="text" name="quantity"  /></td></tr>
    <tr><td>price</td><td><input type="text" name="price" /></td></tr>
    <tr><td>Tax</td><td><input type="text" name="tax" /></td></tr>
    <tr><td colspan="2"><input type="submit" name="submit" /></td></tr>
    </table>
    <input type="hidden" name="submitted" value="1" />
     
    </fieldset>
     
     
     
    </form>
    <?php
    if(isset($_POST['submitted']))
    if (is_numeric($_POST['quantity']) and is_numeric($_POST['price']) and is_numeric($_POST['tax'])){
    $total=($_POST['quantity']*$_POST['price']);
    $taxrate=( $_POST['tax'] / 100 );
    $tax2=($taxrate*$total);
    $end=($tax2+$total);echo $end;}
     
    else
    echo "!! fill it again";
     
     
     
    ?>
    </body>
    </html>
     
×
×
  • Create New...