need help with this

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • albertjun
    New Member
    • Mar 2007
    • 1

    need help with this

    i am new to php and need some help. i have 2 pages one is html and other is .php

    when i run the program it just spits out the code. i am stumped

    here is the html file

    <html>
    <Head>
    <title>Triangle </title>
    </head>
    <body>
    <form action="triangl e.php" method="POST">
    <p>
    sideone:<input type="text" name="a" />
    sidetwo:<input type="text" name="b" />
    sidethree:<inpu t type="text" name="c" />
    <input type="submit" />

    </p>
    </form>
    </body>
    </html>

    here is the php


    <html>
    <head>
    <title>Triangle </title>
    </head>
    <body>
    <?php



    function calculate($firs tside,$secondsi de,$thirdside)
    {

    $firstside=$_PO ST["a"];
    $secondside=$_P OST["b"];
    $thirdside=$_PO ST["c"];

    $total = ($firstside + $secondside);


    if ($total > $thirdside)
    {
    echo "(you have the correct side lengths)";
    }
    else
    {
    echo "(please re-enter the side lenghts)";
    }
    }

    calculate("firs tside","seconds ide","thirdside ");


    ?>

    </body>
    </html>
  • Motoma
    Recognized Expert Specialist
    • Jan 2007
    • 3236

    #2
    What version of PHP and Apache do you have installed?
    What OS are you using?

    Originally posted by albertjun
    i am new to php and need some help. i have 2 pages one is html and other is .php

    when i run the program it just spits out the code. i am stumped

    here is the html file

    <html>
    <Head>
    <title>Triangle </title>
    </head>
    <body>
    <form action="triangl e.php" method="POST">
    <p>
    sideone:<input type="text" name="a" />
    sidetwo:<input type="text" name="b" />
    sidethree:<inpu t type="text" name="c" />
    <input type="submit" />

    </p>
    </form>
    </body>
    </html>

    here is the php


    <html>
    <head>
    <title>Triangle </title>
    </head>
    <body>
    <?php



    function calculate($firs tside,$secondsi de,$thirdside)
    {

    $firstside=$_PO ST["a"];
    $secondside=$_P OST["b"];
    $thirdside=$_PO ST["c"];

    $total = ($firstside + $secondside);


    if ($total > $thirdside)
    {
    echo "(you have the correct side lengths)";
    }
    else
    {
    echo "(please re-enter the side lenghts)";
    }
    }

    calculate("firs tside","seconds ide","thirdside ");


    ?>

    </body>
    </html>

    Comment

    Working...