Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Join Date
    Apr 2007
    Posts
    2,431
    Tokens
    0

    Latest Awards:

    Default Autoresponder for form

    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

    [X] [X] [X]

  2. #2
    Join Date
    Nov 2006
    Posts
    2,572
    Tokens
    0

    Latest Awards:

    Default

    Excellant is your best bet he helped me with my PHP form

    Good luck.

  3. #3
    Join Date
    May 2008
    Posts
    605
    Tokens
    0

    Default

    Quote Originally Posted by Pazza View Post
    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
    Make sure you're using headers too:
    PHP Code:
    $headers "From: [email protected]"
    This way we show who the email is from.
    Oh also, on the mail(); function, include $headers into there, should be fine.

  4. #4
    Join Date
    Apr 2007
    Posts
    2,431
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Excellent1 View Post
    Make sure you're using headers too:
    PHP Code:
    $headers "From: [email protected]"
    This way we show who the email is from.
    Oh also, on the mail(); function, include $headers into there, should be fine.
    Oh BTW its your form

    Erm... I'll try and see , makin' backup cos I know i'll mess up

    [X] [X] [X]

  5. #5
    Join Date
    Apr 2007
    Posts
    2,431
    Tokens
    0

    Latest Awards:

    Default

    PHP 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>
    Tahts my code(Made by excellent) I don't get where to put them in :S
    Last edited by Pazza; 16-08-2008 at 03:56 PM.

    [X] [X] [X]

  6. #6
    Join Date
    May 2008
    Posts
    605
    Tokens
    0

    Default

    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.
    ?>

  7. #7
    Join Date
    Apr 2007
    Posts
    2,431
    Tokens
    0

    Latest Awards:

    Default

    Will the 'headers' change to the e-mail the applicant puts in, so the autoresponse goes to that address?

    [X] [X] [X]

  8. #8
    Join Date
    May 2008
    Posts
    605
    Tokens
    0

    Default

    Quote Originally Posted by Pazza View Post
    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:
    PHP Code:
    $email "$email";
    $message "Lol, thanks for submitting the form!! Whatever blah";
    $headers "From: [email protected]";
    mail("$email","$message","$headers"); 
    This will then send them and email once they have submitted the form.

  9. #9
    Join Date
    Apr 2007
    Posts
    2,431
    Tokens
    0

    Latest Awards:

    Default

    Just testing it now

    [X] [X] [X]

  10. #10
    Join Date
    May 2008
    Posts
    605
    Tokens
    0

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •