# Online Form using PHP and HTML

**URL:** https://forum.kirupa.com/t/online-form-using-php-and-html/237578
**Category:** programming
**Created:** [August 31, 2007, 4:38pm UTC](https://forum.kirupa.com/t/online-form-using-php-and-html/237578 "2007-08-31T16:38:26Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Shaba](https://avatars.discourse-cdn.com/v4/letter/s/54ee81/32.png) [@Shaba](https://forum.kirupa.com/u/Shaba)
#### Post date: [August 31, 2007, 4:38pm UTC](https://forum.kirupa.com/t/online-form-using-php-and-html/237578/1 "2007-08-31T16:38:26Z")

</div>

Firstly Hello to everyone on the forum. Im a neewbie here but have been using Kirupa to help me with a of odd stuff.

I am new to php scripting but thanks to this site I have found some code that shows me the basics of doing this. I have slightly amended the code and uploaded the two files .php and .htm to my server which is run by [streaming.net](http://streaming.net).  
The problem im having is that nothing gets emailed to me when the input boxes are filled in? can anyone help?

my .php code is:

> 

\<?PHP  
$to = “[ata.shahbazi@pervasic.com](mailto:ata.shahbazi@pervasic.com)”;  
$subject = “Results from your Request Info form”;  
$headers = “From: Form Mailer”;  
$forward = 0;  
$location = “”;  
$date = date (“l, F jS, Y”);  
$time = date (“h:i A”);

$msg = "Below is the result of your feedback form. It was submitted on $date at $time.

“;  
if ($\_SERVER[‘REQUEST\_METHOD’] == “POST”) {  
foreach ($\_POST as $key =\> $value) {  
$msg .= ucfirst ($key) .” : ". $value . "  
“;  
}  
}  
else {  
foreach ($\_GET as $key =\> $value) {  
$msg .= ucfirst ($key) .” : ". $value . "  
";  
}  
}  
mail($to, $subject, $msg, $headers);  
if ($forward == 1) {  
header (“Location:$location”);  
}  
else {  
echo “Thank you for submitting our form. We will get back to you as soon as possible.”;  
}  
?\>

and my .htm code is:

> 

\<html\>  
\<body\>  
\<title\> Test Form page \</title\>  
\<form action=“mailer.php” method=“post”\>  
Type your first name:  
\<input type=“text” name=“FirstName” value=“” size=“30”\>  
\<br\>Type your last name:  
\<input type=“text” name=“LastName” value=“” size=“30”\>  
\<br\>  
\<input type=“submit” value=“Submit”\>

\</form\>  
\</body\>  
\</html\>

I would appreciate any help I can get.

thanks
