Secure 1 field php form - help

the mail() function

Moderators: macek, egami, gesf

Davidjohny
New php-forum User
New php-forum User
Posts: 1
Joined: Thu Apr 05, 2012 9:24 am

Secure 1 field php form - help

Postby Davidjohny » Thu Apr 05, 2012 9:31 am

Hello
I have a website with an online email newsletter subscription form in PHP.

Current status:

Step1/- A visitor fills in his email address.
Step 2/- Next, I get visitor email address inside my INBOX.

Current PHP form consist of two pages

================================================
[[[ Page with PHP Form Code | Page NO.1 Formpage.php ]]]

<html><body>
<form name="myform" method="post" action="SEND.php"><br> <br />
<input name="email" type="text" id="email" />
<br />
<input type="submit" name="Submit" value="Submit" />
</form>
</body></html>
================================================
[[[ Confirmation Page Code | Page NO.2 SEND.php ]]]

<?php
$email = $_REQUEST['email'] ;
mail( "myemail@mydomain.com", "Newsletter Request", "From: $email" );
?>
================================================
I have heard about php code injection, malicious script and spam.
How can I secure this simple php two pages form?

Best wishes,
Dave
============

Return to “PHP coding => Mail”

Who is online

Users browsing this forum: No registered users and 1 guest

cron