+ 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!
6 ответов
+ 2
ok thanks! I will see and tell if it worked in a few days
+ 1
Insert the code here so we can take a look.
+ 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>
+ 1
oh I am sorry. I did at it with a name and value and type of submit but forgot to write it here
0
You forgot the submit button. Just put inside the end of the form an <input type="submit" /> worked for me this way.
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.