PHP form processor

P

Paul Watt

Hi guys,

Can anyone recommend a good PHP form processor? Basically I want to design a
form and have the results sent to a php script to email back to me.

TIA

Paul
 
A

abixalmon

PAGE: Form.html

<form action="form_email.php">
<input type="text" name="__GIVE THE NAME__">

---------- Create forms for Name, Address, Email, Subject and Contents
-----------

</form>

----------------------------------------------------------------------

Page: form_email.php

<?php

$message="Hi,

echo $_POST['message'];

//echo all the form results here

End of message

";
$headers = "From: (e-mail address removed)\n";
$headers .= "Reply-To: $name <$email>\n\n";
mail("to_email","Subject",$message,$headers);

?>
 
W

wayne

abixalmon said:
PAGE: Form.html

<form action="form_email.php">
<input type="text" name="__GIVE THE NAME__">

---------- Create forms for Name, Address, Email, Subject and Contents
-----------

</form>

----------------------------------------------------------------------

Page: form_email.php

<?php

$message="Hi,

echo $_POST['message'];

//echo all the form results here

End of message

";
$headers = "From: (e-mail address removed)\n";
$headers .= "Reply-To: $name <$email>\n\n";
mail("to_email","Subject",$message,$headers);

?>

I've been using this one for a few weeks. Works welll for me.

http://www.tectite.com/
 
B

Ben Bacarisse

$headers = "From: (e-mail address removed)\n"; $headers .= "Reply-To: $name
<$email>\n\n"; mail("to_email","Subject",$message,$headers);

Eek! If I understand what you intend, this allows spammers to use address
injection to send mail from your server. Putting this online is very
risky.

All you need do to secure it (I think) is to remove anything "suspicious"
from the $email (the most suspicious being a newline!).
 
T

Toby Inkster

Paul said:
Can anyone recommend a good PHP form processor? Basically I want to design a
form and have the results sent to a php script to email back to me.

For the most part, PHP form to mail stuff is so easy that it's not worth
using a third-party one.

e.g.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<title>PHP Mail Example</title>
<h1>PHP Mail Example</h1>
<?php
$myaddress = '(e-mail address removed)';
$mysubject = 'Feedback from website';

if ( isset($_POST['message']) )
{
$mymessage = "IP: {$_SERVER['REMOTE_ADDR']}\r\n"
. "Browser: {$_SERVER['HTTP_USER_AGENT']}\r\n\r\n"
. stripslashes($_POST['message']);

if (@mail($myaddress, $mysubject, $mymessage))
print "<p>Mail send successfully!</p>\n";

else
print "<p>Failed! Please try again later.</p>\n";
}
?>
<form action="<?= $_SERVER['PHP_SELF'] ?>" method="post">
<div>
<textarea rows=10 cols=60 name="message"></textarea>
<br>
<input type="submit" value="Send Mail">
</div>
</form>
 
N

Neredbojias

With neither quill nor qualm, Toby Inkster quothed:
Paul said:
Can anyone recommend a good PHP form processor? Basically I want to design a
form and have the results sent to a php script to email back to me.

For the most part, PHP form to mail stuff is so easy that it's not worth
using a third-party one.

e.g.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<title>PHP Mail Example</title>
<h1>PHP Mail Example</h1>
<?php
$myaddress = '(e-mail address removed)';
$mysubject = 'Feedback from website';

if ( isset($_POST['message']) )
{
$mymessage = "IP: {$_SERVER['REMOTE_ADDR']}\r\n"
. "Browser: {$_SERVER['HTTP_USER_AGENT']}\r\n\r\n"
. stripslashes($_POST['message']);

if (@mail($myaddress, $mysubject, $mymessage))
print "<p>Mail send successfully!</p>\n";

else
print "<p>Failed! Please try again later.</p>\n";
}
?>
<form action="<?= $_SERVER['PHP_SELF'] ?>" method="post">
<div>
<textarea rows=10 cols=60 name="message"></textarea>
<br>
<input type="submit" value="Send Mail">
</div>
</form>

All right, realize you are hearing from a bloke who has yet to produce a
successful form, but that example certainly looks dubious, too. Where's
the <body> and <html> tags among others, and what about email-address
spam bots? I'd really _like_ to have a good, successful email form in
my possession but don't think I can stand any more rejection...
 
T

Toby Inkster

Neredbojias said:
All right, realize you are hearing from a bloke who has yet to produce a
successful form, but that example certainly looks dubious, too. Where's
the <body> and <html> tags among others,

The BODY and HTML tags are optional in all versions of HTML.
and what about email-address spam bots?

What about them? The bots can't read your address -- PHP executes on the
server end, not the client.
 
N

Neredbojias

With neither quill nor qualm, Toby Inkster quothed:
The BODY and HTML tags are optional in all versions of HTML.


What about them? The bots can't read your address -- PHP executes on the
server end, not the client.

All right, I'm going to try it (-in the next few days.) And if it
_doesn't_ work, you are going to hear _a lot_ of bitchin'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,678
Members
48,796
Latest member
Greg L.

Latest Threads

Top