0
How can I get the values of a form in a php file while the using the form method post
This works on Sololearn but not on other compilers The HTML <html> <body> <form action="test.php" method="post"> <p>Name: <input type="text" name="name" /> </p> <p>Age: <input type="text" name="age" /></p> <p><input type="submit" name="submit" value="Submit" /></p> </form> </body> </html> The PHP (test.php) <html> <body> Welcome <?php echo $_POST["name"]; ?><br /> Your age: <?php echo $_POST["age"]; ?> </body> </html> Then it shows me this without the form values đđżWelcome Your ageđđż
3 Answers
+ 3
The code is actually fine enough ! If you install a server (like using xamp) and create two files like below :
index.php
// your html form
test.php
// welcome php code
Then, after submitting form you'll see the result working as expected.
+ 2
You cannot use php here with html better to use AJAX
+ 1
Thanks Rahim