Thread: Php mail form

    #1
  1. No Profile Picture
    All round clown
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2000
    Posts
    21
    Rep Power
    0
    Hi all,

    I have a php script which I intend to use for a registraion process for people to enrol in some classes by sending an email to the administrator of the course.

    I have 2 problems -

    1. It would be very easy to spam using this script.

    2. It does not have "required fields" in it.

    I would just like a pop-up message to appear when the user trys to submit, and the form not to be sent unitl all the fields are filled in.

    Point no. 2 may actually stop a bit of spamming, but cant see a way around it without using a session or somethink like that ???

    see code below :

    <?


    $site_name = "howdee-doodee";
    $site_email = "null@howdee-doodee.com";

    print("Hi $name, Thanks for using the Booking System! n");
    print("<P>You have applied to book into the following courses! - n");
    print("<P>$course1, on $date1, at $time1 n");
    print("<P>$course2, on $date2, at $time2 n");
    print("<P>$course3, on $date3, at $time3 n");
    print("<P>We will handle your submission in the order of arrival. n");
    ?>

    <?
    mail("$email", "Booking Sytem Message", "$namen

    Hi $name,

    Thanks for using the Booking System!

    You have applied to book into the following courses! -

    $course1, on $date1, at $time1
    $course2, on $date2, at $time2
    $course3, on $date3, at $time3

    We will handle your submission in the order of arrival.
    PLEASE NOTE - **Bookings are not confirmed until a confirmation email is sent.**
    If other details are needed we will contact you.

    Please make sure the details you entered previously are correct, so we can contact you -

    $name
    $email
    $ph_number
    $student_id_number

    Regards,");

    mail("$site_email",
    "$site_name Contact Form",
    "Submitted By: $name
    Email address: $email
    Student ID: $student_id_number
    Contact Phone number: $ph_number
    course: $course1
    Date: $date1
    Time : $time1
    course: $course2
    Date: $date2
    Time : $time2
    course: $course3
    Date: $date3
    Time : $time3

    Comments:
    $Comments
    $HTTP_USER_AGENT");
    ?>

    I just have a simple form to collect the variables for execution.

    Any help would be appreciated!

    Regrads
    Null
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    51
    Rep Power
    15
    Hey null,

    you could set a cookie right above the mail() command in the second script.

    in the first script, verify that the cookie does not exist on their pc. if it does, display some message saying "Sorry, Spamboy!".

    Otherwise, show them the form.

    In regards to error checking, just check any decent javascript site. There is more than enough examples out there to allow you to bulid client-side form verifying code in no time.

    wj gilmore
    wjgilmore@hotmail.com

Similar Threads

  1. php sending mail?
    By stojan in forum PHP Development
    Replies: 2
    Last Post: February 12th, 2004, 11:25 PM
  2. Email form in PHP was told having problems on a MAC?
    By solcjoye in forum HTML Programming
    Replies: 0
    Last Post: February 12th, 2004, 03:32 PM
  3. Help with script
    By akastarlight in forum Perl Programming
    Replies: 1
    Last Post: February 6th, 2004, 07:55 AM
  4. php for checking mail errors
    By jnccneto in forum PHP Development
    Replies: 0
    Last Post: January 25th, 2004, 09:15 PM
  5. HTTP Error 400: Bad Request, with basic form
    By crackwombat in forum PHP Development
    Replies: 1
    Last Post: January 23rd, 2004, 07:40 PM

IMN logo majestic logo threadwatch logo seochat tools logo