Page 1 of 1

confused about forms

Posted: Tue Mar 18, 2008 12:22 pm
by gammaman
I have the following code, but when I click submit, I am confused as to where the information is being sent, and how I go about getting it to display it.

Code: Select all

 
<html>
<body>
<FORM action="E:\Senior Project\comment.html" method="post">
 
First Name:
<input type ="text" name="firstname"/>
&nbsp
Last Name:
<input type ="text" name="lastname"/>
<br/>
<br/><dd/>
Comments orSuggestions:
<br/><dd/>
<textarea name="comment" rows="10" cols="50"></textarea>
</textarea>
<input type = "submit" value="submit">
</form>
 
<?php
$firstname=$_POST['firstname'];
$lastname=$_POST['lastname'];
$comment=$_POST['comment'];
 
echo $firstname.'&nbsp;'.$lastname.':'.'&nbsp'.$comment;
?>
</body>
</html>
 

Re: confused about forms

Posted: Tue Mar 18, 2008 12:52 pm
by RobertGonzalez
Right now your form is being sent to E:\Senior Project\comment.html. That file, unless your server is setup to parse HTML files as server side code files, will not do anything at all for you.

Re: confused about forms

Posted: Tue Mar 18, 2008 4:26 pm
by gammaman
I need a way for this information to be submitted and then be viewable by the user via a
"view comments link" on that same page where they submitted the data.

Re: confused about forms

Posted: Tue Mar 18, 2008 4:36 pm
by RobertGonzalez
Then you are going to need a server side program (PHP perhaps? Or even Perl/.NET/ColdFusion/JSP/the list goes on) to receive the posted form data, process it and show it.