Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 1 of 2 12 LastLast
Results 1 to 10 of 15
  1. #1
    Join Date
    Apr 2008
    Location
    England.
    Posts
    1,324
    Tokens
    0

    Latest Awards:

    Default Jop application form.

    Hey theres a few about but a lot of people want to know how to make an application form, heres the code, I have used comments to show you what to do.

    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.
            
    $from "$name,$job"//Displays the applicants name and the job they want.
            
    $subject "$name has applied for the $job!"//Displays the name and the job in the email subject.
            
    $msg "Heres their details:<br><br>
            
    $email$name$job<br><br>$msg"//The users message.
            
    mail("$mail","$from","$subject","$msg"); //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>
        </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.
    ?>

  2. #2
    Join Date
    Apr 2008
    Location
    England.
    Posts
    1,324
    Tokens
    0

    Latest Awards:

    Default

    Oh btw please don't claim you made this if you use it

    Edited by Invent (Forum Moderator): Please do not double post.
    Last edited by Invent; 07-08-2008 at 06:47 PM.

  3. #3
    Join Date
    Nov 2007
    Posts
    1,253
    Tokens
    150

    Latest Awards:

    Default

    I can already see errors in it like you not closing off strings...


    www.fragme.co = a project.

  4. #4
    Join Date
    Apr 2008
    Location
    England.
    Posts
    1,324
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Source View Post
    I can already see errors in it like you not closing off strings...
    Works fine when I submit an email on my server. All strings are closed or php would return a nasty error.

  5. #5
    Join Date
    Nov 2007
    Posts
    1,253
    Tokens
    150

    Latest Awards:

    Default

    dw I only skimmed over it, just saw you broke it up over 2 lines. My bad.


    www.fragme.co = a project.

  6. #6
    Join Date
    Apr 2008
    Location
    England.
    Posts
    1,324
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Source View Post
    dw I only skimmed over it, just saw you broke it up over 2 lines. My bad.
    Haha no worries, over the $msg string?

  7. #7
    Join Date
    Apr 2008
    Location
    England.
    Posts
    1,324
    Tokens
    0

    Latest Awards:

    Default

    Quick edit: With the first script when you looked at the emails all the details were messed up, heres the edit! MOD merge if you will :0

    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.
            
    $mess "Heres their details:
            Name: 
    $name
            Email: 
    $email
            Job: 
    $job
            Message:
            
    $sub";
            
            
    mail("$mail","$subject","$mess"); //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.
    ?>

  8. #8
    Join Date
    Jul 2008
    Posts
    535
    Tokens
    75

    Default

    It'll still be messed up, as you forgot line breaks.

  9. #9
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    I suggest next time you read php.net for the actual process of using mail()

    mail(e-mail to, subject, message, headers);

    You didn't do that.

  10. #10
    Join Date
    Apr 2008
    Location
    England.
    Posts
    1,324
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by BOX! View Post
    It'll still be messed up, as you forgot line breaks.
    No no, the script itself works 100% fine, the coding isn't as clean as it could be though.

    Quote Originally Posted by Dentafrice View Post
    I suggest next time you read php.net for the actual process of using mail()

    mail(e-mail to, subject, message, headers);

    You didn't do that.
    Thanks for the tip

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
  •