Village wrote:
I have installed PHP a number of times following tutorials from online
and from a book. I have been able to process simple functions such at
date() but when it comes to simply sending information from a HTML form
to a PHP page to display it doesn't work.
I know it isn't my programming as i have copied it word for word from a
book, and even used one of their examples from the site.
The code I have used in the PHP page is:
<?php
/* This page receives and handles the data generated by "form.htm".*/
print "Your first name is $FirstName.<BR>\n";
print "Your last name is $LastName.<BR>\n";
print "Your E-mail address is $email.<BR>\n";
print "This is what you had to say:<BR>\n$Comments<BR>\n";
?>
and all of those variables relate to a text field in the form on the
HTML page (form.htm).
Any suggestions on how to sort this out?
Thank you very much
Hi,
Well, you didn't show us all your code, so it is hard to say what went
wrong.
Try this:
send.html
***************************************
<html>
<body>
<form action="receive.php" method="Post">
firstname:<input type="text" name="firstname">
<br>
LastName<input type="text" name="LastName">
<br>
email:<input type="text" name="email">
<br>
Comments:<input type="text" name="Comments">
<br>
<input type="submit" value="Post me please">
</form>
</body>
</html>
***************************************
and the file receive.php:
***************************************
<?
$firstname=$_POST["firstname"];
$LastName=$_POST["LastName"];
$email=$_POST["email"];
$Comments=$_POST["Comments"];
?>
<html>
<body>
I received:
<br>
Firstname: <? echo $firstname; ?><br>
LastName: <? echo $LastName; ?><br>
email: <? echo $email; ?><br>
Comments: <? echo $Comments; ?><br>
</body>
</html>
***************************************
That code should always work.
Regards,
Erwin Moller