The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.

Results 1 to 9 of 9

Thread: Please help- php form problem

  1. #1

    Afrostyle Please help- php form problem

    I'm new to coding and the likes. I set up a form using http://www.kirupa.com/web/php_contact_form4.htm and it worked for the basic info. However when I put in all the info I needed it doesn't send the email ordisplay anything once you hit submit.

    My contact.html form is:

    <form method="POST" action="mailer.php">

    <table border="0">

    <tr>
    <td>
    Name
    </td>
    <td>
    <input type="text" name="name" value="type name here" />
    </td>
    </tr>

    <tr>
    <td>
    Contact Number
    </td>
    <td>
    <input type="text" name="contact" value="type number here" />
    </td>
    </tr>

    <tr>
    <td>
    Email
    </td>
    <td>
    <input type="text" name="email" value="type email here" />
    </td>
    </tr>

    <tr>
    <td>
    Required date
    </td>
    <td>
    <input type="text" name="date" value="dd/mm/yy" />
    </td>
    </tr>

    <tr>
    <td>
    Please select
    </td>
    <td>
    <!--pull-down menu-->
    <select name="drop_down">
    <option value="school ball/disco">School Ball/Disco</option>
    <option value="birthday">Birthday</option>
    <option value="party">Party</option>
    <option value="other">Other</option>
    </select>
    </td>
    </tr>

    <tr>
    <td>
    Style of Music
    </td>
    <td>
    <textarea name="music" rows="5" cols="40">what kind of music do you want to be played
    </textarea>
    </td>
    </tr>

    <tr>
    <td colspan="2">
    <input type="submit" value="Send" name="submit"/>
    </td>
    </tr>

    </table>

    </form>

    and the mailer.php:

    <?php
    if(isset($_POST['submit'])) {

    $to = "neopets3010@hotmail.com";
    $subject = "booking";
    $name_field = $_POST['name'];
    $contact_field = $_POST{'contact'};
    $email_field = $_POST['email'];
    $date_field = $_POST['date'];
    $drop_down = $_POST['drop_down'];
    $music = $_POST['music'];

    foreach($_POST['check'] as $value) {
    $check_msg .= "Checked: $value\n";

    $body = "From: $name_field\n E-Mail: $email_field\n Contact number: $contact_field\n Drop-Down: $drop_down\n Date required: $date_field\n Music Style: $music\n";

    echo "Data has been submitted to $to!";
    mail($to, $subject, $body);

    } else {

    echo "We have encountered an error";

    }
    ?>


    Please help me.
    Thanks in advance

  2. #2
    PHP Code:
    $contact_field $_POST{'contact'}; 
    is wrong
    Let us live so that when we come to die even the undertaker will be sorry. - Mark Twain
    Don't PM me your CSS, xHTML, JS or PHP questions. I will not reply to ANY IE6 questions.

  3. #3
    what simplistik means is that the curly brackets aren't the same as the square brackets and will cause the script to fail. If you have error reporting turned off on your server it will just display a blank screen.

    Try
    PHP Code:
    $contact_field $_POST['contact']; 

  4. #4
    I chacknged the curly brackets and it still shows up a blank page

  5. #5
    **changed

  6. #6
    your foreach loop isn't closed
    Let us live so that when we come to die even the undertaker will be sorry. - Mark Twain
    Don't PM me your CSS, xHTML, JS or PHP questions. I will not reply to ANY IE6 questions.

  7. #7
    i think it all just hates me. i fixed that and it still shows up blank

  8. #8
    post your new code ... use the proper php code tags too please [php][/php]
    Let us live so that when we come to die even the undertaker will be sorry. - Mark Twain
    Don't PM me your CSS, xHTML, JS or PHP questions. I will not reply to ANY IE6 questions.

  9. #9
    i gots it working
    thanks

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012