+ 1
How do I run php here in learn php?
Newbie User
4 Answers
+ 14
Post your errors here.
+ 3
Remove the action attribute
0
Ahm I know these kind of stuffs here but I dont know how to run my php file. I have some errors (not code related though).
0
Alright now I got rid of the error. Now, the output won't show. It should add the 2 numbers after clicking the button. I made it run on my laptop but it seems that there's a mistake I couldn't solve. Here's my code
<!DOCTYPE html>
<html>
    <head>
        <title>Page Title</title>
    </head>
    <body>
        <form action="operate.php" method="post">
        <input type="text" name="v1"><br><br>
        <input type="text" name="v2"><br><br>
        <input type="submit" name="add" value="+"><br><br>
        
        <?php
        if(isset($_POST['add'])){
            $a = $_POST['v1'];
            $b = $_POST['v2'];
            $c = ((int)$a + (int)$b);
            echo "Answer: ",$c;
        }
        ?>
    </body>
</html>






