PHP tags not working. Help! | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 1

PHP tags not working. Help!

I have made form the exact same as described in the PHP forms lesson in PHP fixed variables. But the <?php ?> code i wrote in the PHP file connected to the action of the form doesn't work and when I inspect the page it had commented it out... why? help!

23rd Feb 2018, 5:09 PM
Ashma Zaheer
Ashma Zaheer - avatar
6 Respostas
+ 2
ok thanks! I will see and tell if it worked in a few days
23rd Feb 2018, 5:37 PM
Ashma Zaheer
Ashma Zaheer - avatar
+ 1
Insert the code here so we can take a look.
23rd Feb 2018, 5:13 PM
Kevin Eldurson
Kevin Eldurson - avatar
+ 1
it has not been done here but on my computer, but here: html file: (after the title and head and html tag etc.) <body> <form action="action.php" method ="post"> <p>Name: <input type="text" name="name" /></p> <p>Age: <input type="number" name="age" /></p> </form> </body> the PHP file (action.php) (after head and title tag etc.) <body> Welcome <?php echo $_POST['name']; ?> You are <?php echo $_POST['age']; ?> years old </body>
23rd Feb 2018, 5:21 PM
Ashma Zaheer
Ashma Zaheer - avatar
+ 1
oh I am sorry. I did at it with a name and value and type of submit but forgot to write it here
23rd Feb 2018, 5:33 PM
Ashma Zaheer
Ashma Zaheer - avatar
0
You forgot the submit button. Just put inside the end of the form an <input type="submit" /> worked for me this way.
23rd Feb 2018, 5:30 PM
Kevin Eldurson
Kevin Eldurson - avatar
0
Wait a minute, I know what's your problem. PHP is a server side programming language, without having set up a server it won't work, download XAMP or use a free webhost like 000webhost in order to use PHP.
23rd Feb 2018, 5:36 PM
Kevin Eldurson
Kevin Eldurson - avatar