Results 1 to 5 of 5
  1. #1

    Default simple php program


    mga master patabang ko ani na code
    try1.php
    <html><body>
    <form action="try2.php" method="POST">
    Price 1: <input type="text" name="price1"><br/>
    Unit 1: <input type="text" name="unit1"><br/>
    Price 2: <input type="text" name="price2"><br/>
    Unit 2: <input type="text" name="unit2"><br/>
    Price 3: <input type="text" name="price3"><br/>
    Unit 3: <input type="text" name="unit3"><br/>
    Price 4: <input type="text" name="price4"><br/>
    Unit 4: <input type="text" name="unit4"><br/>
    <input type="radio" name="operation" value="installment">installment
    <input type="radio" name="operation" value="fullpayment">fullpayment<br/>
    <input type="submit" name="submit">
    </form>
    </body>
    </html>
    <html><body>
    <?PHP
    if (isset($_POST['submit'])) {
    $selected_radio = $_POST["operation"];
    if ($operation == "installment")
    {
    //computation
    $SubTotal = $_POST["price1"] + $_POST["price2"] + $_POST["price3"] + $_POST["price4"];
    $TotalUnit = $_POST["unit1"] + $_POST["unit2"] + $_POST["unit3"] + $_POST["unit4"];
    $downpayment = ($TotalUnit * 920) + 4000;
    $Fullprice = $SubTotal + 4000;
    $PerSemPrice = $Fullprice - $downpayment;

    //display
    echo "Subtotal: " . $SubTotal . "<br/>";
    echo "Mics: 4000" . "<br/>";
    echo "Full Price: " . $Fullprice . "<br/>";
    echo "Downpayment: " . $downpayment . "<br/>";
    echo "Per Semestral price" . $PerSemPrice;

    }else if
    ($operation = "fullpayment") {
    //computation
    $SubTotal = $_POST["price1"] + $_POST["price2"] + $_POST["price3"] + $_POST["price4"];
    $TotalUnit = $_POST["unit1"] + $_POST["unit2"] + $_POST["unit3"] + $_POST["unit4"];
    $Discountprice = $TotalUnit * 800;
    $Fullpayment = ($SubTotal - $Discountprice ) + 4000;

    //display
    echo "Subtotal: " . $SubTotal . "<br />";
    echo "Mics: 4000" . "<br/>";
    echo "Discounted Price: " . $Discountprice . "<br />";
    echo "Full Payment Price: " . $Fullpayment;


    }
    }
    ?>


    </body>
    </html>
    dli mo display ang fullpayment even g select na nako ang full payment radio button, permi niya e display ang partial.

  2. #2
    Unsay pasabot nimo nga partial TS?

  3. #3
    Quote Originally Posted by predator50 View Post
    $selected_radio = $_POST["operation"];

    if ($operation == "installment")
    {

    e change to:

    $operation = $_POST["operation"];

  4. #4
    Quote Originally Posted by emailroy2002 View Post
    e change to:

    $operation = $_POST["operation"];
    salamat boss. ni gana na gyud.

  5. #5
    Quote Originally Posted by predator50 View Post
    salamat boss. ni gana na gyud.
    pra mas dali imo pag debug boss try gamit og var_dump(); kng naa ba sulod or resulta imo variable.

  6.    Advertisement

Similar Threads

 
  1. help, im stuck! in PHP programming.
    By emailroy2002 in forum Programming
    Replies: 16
    Last Post: 07-08-2010, 11:43 PM
  2. Replies: 42
    Last Post: 07-10-2009, 03:41 PM
  3. Looking For: PHP Programers
    By dongkey in forum Jobs
    Replies: 1
    Last Post: 05-13-2009, 11:34 PM
  4. what's school offers PHP programming / training?
    By cliff_drew in forum Programming
    Replies: 10
    Last Post: 10-30-2008, 09:50 PM
  5. asa nindut e skuela ug php programming dire sa cebu?
    By mimew in forum Networking & Internet
    Replies: 6
    Last Post: 10-27-2008, 10:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top