You are here: Re: How to send form data to email id by using PHP « All PHP « IT news, forums, messages
Re: How to send form data to email id by using PHP

Posted by J.O. Aho on 06/22/07 14:27

Malli mindwave wrote:
> Hi,
>
> We are using the yahoowebHostiing service for my company website, In
> that one screen of the SendComments/FeedBack section is there, I'm
> basically dot.net develeoper ,but yahoowebhosting not
> support .asp,.aspx files, it supports PHP files,
>
> I'm searching in JavaScript ,but not found any matter,
> I'don't Know PHP.I'm having lot of pressure of higer officials.Please
> help me on this.
> Please give the Details of the PHP to send form data to given mail id
> Name,email,phoneNo, Commnets...........thease are the fileds and by
> click send it would be come to given to address mail id,
> and how to run the php code, Please send the PHPCODE and Procee,I will
> put it on the server

If your webhost allows the usage of mail(), it's quite simple

---- form.html ----
<html><head><title>Form Page</title></head><body>
<form action="send.php">
Email:<input text="e-mail"><br>
Short message:<input text="msg"><br>
</form>
</body></html>
---- eof ----


---- send.php ----
<?PHP
//As we are lazy, we don't want to set a from address on the mail, as
//it's the place where spammers can inject extra headers and that way send
//spam to the whole world, so we put everything into the message body
$messagebody=<<<EOF
Senders e-mail address: {$_POST['e-mail']}
The message sent to us: {$_POST['msg']}
EOF;

//we set the headers to null as we don't want to add any
$messageheaders=null;

//Here we send the mail to youraddress@exmple.net
//We hardcode the address here, or else spammers could
//select to send the mail to anyone else than you
mail('youraddress@exmple.net','Form mail subject',$messagebody,$messageheaders);
?>
<html><head><title>Form Page</title></head><body>
Thanks for your feedback
</body></html>
---- eof ----


You have www.php.net with the online manual with tons of useful user comments
to get the information you need. Just remember to not trust data that is
posted to a mail form, as there are too many US spammers who will take
advantage of any sloopy coding you have made, no matter if you use PHP, Perl
or even basic.

--

//Aho

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация