Hey, I have a PHP form.
There is a default from e-mail, dunno what it is. But, autoresponders arent working for the form. So is there any way to do it.
+rep for help
Printable View
Hey, I have a PHP form.
There is a default from e-mail, dunno what it is. But, autoresponders arent working for the form. So is there any way to do it.
+rep for help
Excellant is your best bet he helped me with my PHP form :)
Good luck.
Make sure you're using headers too:
This way we show who the email is from.
Oh also, on the mail(); function, include $headers into there, should be fine.
Tahts my code(Made by excellent) I don't get where to put them in :SPHP Code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>BobbaFM Staff Applications</title>
</head>
<body background="habbo.gif">
<center>Please only send 1 application, however you may send another if you do not get through, this time?
<p>
<p>
<?php
if(isset($_POST['send'])) { //Checks if the applicant has submitted the form.
if((!$_POST['email']) || (!$_POST['name']) || (!$_POST['sub']) || (!$_POST['job'])) { //Make sure they have filled in all fields.
echo "Some fields have been left blank, please go back and refill them!"; //Display the error.
} //End the check on the fields.
else //Maybe..
{
$email = addslashes(htmlspecialchars($_POST['email'])); //Removes the slashes.
$name = addslashes(htmlspecialchars($_POST['name']));
$sub = addslashes(htmlspecialchars($_POST['sub']));
$job = addslashes(htmlspecialchars($_POST['job']));
$mail = "[email protected]"; //Change this to the the email you want the message to go to.
$subject = "$name with the e-mail: $email has applied for the job: $job !"; //Displays the name and the job in the email subject.
$mess = "Heres their details:
<p>Name: $name
<br>Email: $email
<br>Job: $job
<br>Why we should choose them:
<br>$sub";
mail("$mail","$subject","$mess"); //We use the mail(); function to send the email.
echo "Your application has been sent, we will reply within 48 hours!"; //Hooharr! Success!
} //End the else.
} // End the post.
else //Form time!
{
echo "<form method='post' action='$_SERVER[PHP_SELF]'>
Email:<br>
<input type='text' name='email' size='30'><br>
Name:<br>
<input type='text' name='name' size='30'><br>
Job:<br>
<select name='job' size='1'>
<option value='Radio manager' value='Radio manager'>Radio manager (x3)</option>
<option value='Head DJ' value='Head DJ'>Head DJ (x6)</option>
<option value='DJ' value='DJ'>DJ (x12)</option>
<option value='News Manager' value='News Manager'>News Manager (x2)</option>
<option value='Senior Reporter' value='Senior Reporter'>Senior Reporter (x4)</option>
<option value='News Reporter' value='News reporter'>News reporter (x12)</option>
</select><br>
Why we should choose you (In as much detail as possible)<br>
<textarea name='sub' cols='45' rows='6'>If your application doesn't fill this, you don't have a chance :)</textarea><br>
<input type='submit' name='send' value='Submit'></form>";
//You can change these values or whatever, have fun.
} //End the last else.
?>
</center>
</body>
</html>
Use this (with headers, change the email):
PHP Code:<?php
if(isset($_POST['send'])) { //Checks if the applicant has submitted the form.
if((!$_POST['email']) || (!$_POST['name']) || (!$_POST['sub']) || (!$_POST['job'])) { //Make sure they have filled in all fields.
echo "Some fields have been left blank, please go back and refill them!"; //Display the error.
} //End the check on the fields.
else //Maybe..
{
$email = addslashes(htmlspecialchars($_POST['email'])); //Removes the slashes.
$name = addslashes(htmlspecialchars($_POST['name']));
$sub = addslashes(htmlspecialchars($_POST['sub']));
$job = addslashes(htmlspecialchars($_POST['job']));
$mail = "[email protected]"; //Change this to the the email you want the message to go to.
$subject = "$name has applied for the $job job!"; //Displays the name and the job in the email subject.
$headers = "From: [email protected]";
$mess = "Heres their details:
Name: $name
Email: $email
Job: $job
Message:
$sub";
mail("$mail","$subject","$mess","headers"); //We use the mail(); function to send the email.
echo "Your application has been sent, we will reply within 2-3 working days!"; //Hooharr! Success!
} //End the else.
} // End the post.
else //Form time!
{
echo "<form method='post' action='$_SERVER[PHP_SELF]'>
Email:<br>
<input type='text' name='email' size='30'><br>
Name:<br>
<input type='text' name='name' size='30'><br>
Job:<br>
<select name='job' size='1'>
<option value='Radio manager' value='Radio manager'>Radio manager</option>
<option value='DJ' value='DJ'>DJ</option>
<option value='News team' value='News team'>News team</option>
<option value='Graphics team' value='Graphics team'>Graphics team</option>
<option value='Forum MOD' value='Forum MOD'>Forum MOD</option>
<option value='Alterations team' value='Alterations team'>Alterations team</option>
<option value='Forum Manager' value='Forum Manager'>Forum Manager</option>
</select><br>
Message:<br>
<textarea name='sub' cols='45' rows='6'></textarea><br>
<input type='submit' name='send' value='Submit'></form>";
//You can change these values or whatever, have fun.
} //End the last else.
?>
Will the 'headers' change to the e-mail the applicant puts in, so the autoresponse goes to that address?
Here, under the echo "Your application has been sent, we will reply within 48 hours!";
put:
This will then send them and email once they have submitted the form.PHP Code:$email = "$email";
$message = "Lol, thanks for submitting the form!! Whatever blah";
$headers = "From: [email protected]";
mail("$email","$message","$headers");
Just testing it now :)
Let me know if it works out.
IT WORKS :D
I also amazed myself by putting $job in the e-mail, saying what they applied for.
+rep :D
EDIT - Can't, I owe :)
loool
Since ur good at PHP, what helped u learn it?
Also, I'm annoying you now, but how do I make it so If they select Radio manager, it comes up with form for that, news manager form for that etc.