Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2007
    Posts
    2,431
    Tokens
    0

    Latest Awards:

    Default I'll explain in thread :(

    Hey,

    My code:
    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.
    ?>
    How do I make it so if they select "radio manager", a form will expand for them, if they select DJ that radio manager form will collapse and Dj one will expand if you get me.

    _+rep for any help

    [X] [X] [X]

  2. #2
    Join Date
    Mar 2008
    Location
    Swindon, UK
    Posts
    1,274
    Tokens
    187
    Habbo
    :Ltd

    Latest Awards:

    Default

    from what you are asking 4 you will need to use some js
    Hi, names James. I am a web developer.

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

    Latest Awards:

    Default

    Well, i dont mean expand like style, just it shows another form.

    But if I need JS for that, damn

    [X] [X] [X]

  4. #4
    Join Date
    Jul 2008
    Location
    Leeds, UK
    Posts
    47
    Tokens
    0

    Default

    Yes, you do need some JS. But it isn't much JS.
    Code:
    <script type="text/javascript">
    var lastopen="";
    function toggle_form(id){
        if(lastopen!=""){
            document.getElementById(lastopen).style.display = "none";
        }
        document.getElementById(id).style.display = "block";
        lastopen=id;
    }
    </script>
    Thats it for the JS.

    There isn't much HTML either
    Code:
    <a href="javascript:toggle_form('box1')">Box 1</a> - <a href="javascript:toggle_form('box2')">Box 2</a>
    <div id="box1" style="display: none;">
    *PUT ONE OF YOUR FORMS HERE*
    </div>
    <div id="box2" style="display: none;">
    *PUT A DIF ONE OF YOUR FORMS HERE*
    </div>
    If you havn't realised, the id of your box goes into the link:
    Code:
    <a href="javascript:toggle_form('*DIV BOX ID HERE*')">*BOX NAME*</a>

Posting Permissions

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