My html page 'nameinfo' has this on it:
<body>
<form action="name.php" method="post">
First Name: <br>
<input type="text" name="firstname"> <br>
Last Name: <br>
<input type="text" name="lastname"> <br> <br>
<input type="submit" value="submit data">
</form>
</body>
Now this data the user enters is supposed to send to a page called 'name.php'. When the page opens up all it shows is my php code. Why is this. Where should i put the name.php page?
create a page called name.php
<?php
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
echo $firstname;
?>
It will show the Firstname data...
put this in your name.php and it will display all the data containing in your POST method at name.php.
<?php
echo "<pre>";
print_r($_POST);
?>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.