+ 1

How do I run php here in learn php?

Newbie User

15th Aug 2018, 6:06 AM
Angelo Panal
Angelo Panal - avatar
4 Réponses
+ 14
Post your errors here.
15th Aug 2018, 7:41 AM
Igor Makarsky
Igor Makarsky - avatar
+ 3
Remove the action attribute
15th Aug 2018, 1:26 PM
Toni Isotalo
Toni Isotalo - avatar
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).
15th Aug 2018, 7:28 AM
Angelo Panal
Angelo Panal - avatar
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>
15th Aug 2018, 7:46 AM
Angelo Panal
Angelo Panal - avatar