help with forms
Posted: Mon Feb 25, 2008 3:20 pm
I need help with a form that allows the user to enter and submit the information, and then that information that they enter is automatically dislplayed below on the same page, after they hit the submit button. Here is the code I have.
Here is the html code (comment.html)
***** PLEASE USE THE CODE TAG WHEN POSTING *****
Here is the php code (post.php)
I do not want the the info when submitted to be displayed on the php page, I want it displayed on the html page where it was submitted, I was told I needed a php page to do that, but I cannot get it to work.
Here is the html code (comment.html)
***** PLEASE USE THE CODE TAG WHEN POSTING *****
Code: Select all
<html>
<body>
<form action="post.php" method="post">
First Name:
<input type ="text" name="firstname"/>
 
Last Name:
<input type ="text" name="lastname"/>
<br/>
<br/><dd/>
Comments orSuggestions:
<br/><dd/>
<textarea name="comment" rows="10" cols="50"></textarea>
</textarea>
</form>
</body>
</html>Code: Select all
<?php
$firstname=$_GET['firstname'];
$lastname=$_GET['lastname'];
$comment=$_GET['comment'];
echo $firstname;
echo "&4nbsp; $lastname";
echo ":";
echo " $comment";
?>