DIGIT-ARC read-only archive · snapshot: July 23, 2026

Getting data from a from and sending it though email

4 posts · originally from https://geek.digit.in/community/threads/getting-data-from-a-from-and-sending-it-though-email.111097/

bharat_r
bharat_r Original post #1
Mar 18, 2009 at 5:36 PM
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
Mar 18, 2009 at 9:36 PM
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.
bharat_r
Mar 21, 2009 at 6:42 PM
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
Mar 21, 2009 at 6:59 PM
IIRC & AFAIK PHP is server sided scripting, so you need sever side scripting. So you need a proper webhost.