PDA

View Full Version : PHP Email form



Blazz
09-12-2007, 11:55 AM
Hi, this is Blazz. I've gone off of habbo but i know this site is good for coding etc.

Anyway, im creating a Designing website and i was wondering how you would create a php form so it will email to me, is there any generator to make one?

+REP !

:eusa_whis

Hashbrown
09-12-2007, 02:22 PM
No there is not one to generate.

adamFTW
09-12-2007, 02:27 PM
Use something like this, just edit it to your needs:



<?php
// These are the variables
$name = ($_POST["name"]);
$job = ($_POST["job"]);
$aboutme = ($_POST["aboutme"]);
$email = ($_POST["email"]);
$to = "[email protected]";
$subject = "Email subject";
$message = "email body";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n";

// After the form is sent, the following makes sure the user entered everything in the form.
if ($_GET["action"] == "submit")
{
if ($name == "")
{
echo "Whoops! You didn't enter your name.";
exit;
}
if ($job == "")
{
echo "Whoops! You didn't enter a job to apply for.";
exit;
}
if ($aboutme == "")
{
echo "Whoops! You didn't enter anything about yourself.";
exit;
}
if ($email == "")
{
echo "Whoops! You didn't enter an email, we need this to contact you.";
exit;
}

echo "Thanks for applying, add whatever information you want here";
mail($to,$subject,$message,$headers);
exit;
}

// Now, its time to display the actual form
echo "Hi, here is the app form, add details about your site and whatever here.<br>
<br>
<form action=\"?action=submit\" method=\"post\">
Name:
<input type=\"text\" name=\"name\">
Job:
<input type=\"text\" name=\"job\">
Email:
<input type=\"text\" name=\"email\">
About me:
<input type=\"text\" name=\"aboutme\">";
That should work, I haven't tested it but i'm pretty sure it'll work.

Blazz
11-12-2007, 07:08 PM
No there is not one to generate.

Why did you post this, there was no point what so ever. :S

adamFTW, i've +REPPED You, thanks for the code :D

Jordy
11-12-2007, 07:38 PM
It's PHP, works fine, no advertising, good experiences with it.

http://www.freeformmaker.com/

If you want to edit it manually afterwards it never seems to work as the code is garbled but some how works, make sure you make the form correctly the first time.

And whoever said there's no generator? Google is your friend!

Want to hide these adverts? Register an account for free!