Getting data from a from and sending it though email

Status
Not open for further replies.

bharat_r

In the zone
I want to design a webpage which would get data from a form and send the collected data to my mail id.

I used the following html codes to get the data:

Code:
<html>
<head><Title></Title></head>
<form method="post" action="contact.php">
Email: <input name="email" type="text"><br>
Message:<br>
<textarea name="message" rows="15" cols="40"></textarea><br>
<input name="send" type="submit">
</form> 
</html>

And used the following php script
Code:
<?php
$to = "bharatkrishna.r@gmail.com";
$subject = "Contact Us";
$email = $_REQUEST['email'] ;
$message = $_REQUEST['message'] ;
$headers = "From: $email";
$sent = mail($to, $subject, $message, $headers) ;
if($sent)
{print "Your mail was sent successfully"; }
else
{print "We encountered an error sending your mail"; }
?>

But I'm not getting what I enter in the form to my mail.

How do I do it. Please Help.
 

mediator

Technomancer
AFAIR, u need to configure ur local sendmail server for that or perhaps u may test it on some site of urs say wwwdotbharat_rdotcom coz sites r usually configured with a mail server.
 
OP
bharat_r

bharat_r

In the zone
I dont have a site. I just use googlepages and geocities to host my web pages...

So it can't be done by me eh?
 

Liverpool_fan

Sami Hyypiä, LFC legend
IIRC & AFAIK PHP is server sided scripting, so you need sever side scripting. So you need a proper webhost.
 
Status
Not open for further replies.
Top Bottom