Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jul 2007
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Format my Forms?

    hey guys
    i was wandering (i cant script for poo)
    i got my friend to make some simple forms for my webstie contact section (www.jazzastudios.com/contact.html) and when i get emails from those forms they end up like this:


    worse still, lately i've been getting porn-spam. Not good.

    How do i format the forms so the email and name and subject, appear where they should, in the header thing?

    how do i make it so people HAVE to enter an email adress in the email adress bit?

    How to i stop spambots and pornlinks?

  • #2
    Senior Coder TheShaner's Avatar
    Join Date
    Sep 2005
    Location
    Orlando, FL
    Posts
    1,126
    Thanks
    2
    Thanked 40 Times in 40 Posts
    The sent.php script that your form is submitting to needs to be redone. Apparently your friend just sent you the unformatted output he collected from the form. Just have him redo the PHP email function he must've created with the required formatting and email address checking you need. He should know how. If not, then we'll need to see the code of sent.php so that we can tell you how to modify it (of course, if you post the code, make sure you edit out any personal information).

    -Shane

  • #3
    New Coder
    Join Date
    Jan 2005
    Location
    Iowa City
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts
    To make an email address required, you just need to check it in the sent.php page to make sure it is valid. A simple way to make sure it was filled out would be:

    PHP Code:
    if(empty($_POST['textfield222'])){
     
    //display error message
    }
    else{
     
    //mail the form here

    However, you can get more advanced to make sure that the email address entered is actually valid. For example, the following uses regular expressions to make sure the email is proper:
    PHP Code:
    if(eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"$_POST['textfield222'])) {
     
    //mail form here
    }
    else {
     
    //email is not valid, display error

    TheShaner is corrrect that you need to re-do the mail function. It should be pretty easy, it is just a matter of creating a string for the body, and formatting it with the variables the way you want. For more information go to:
    http://php.codeislogic.com/howto-sub...orm-via-email/

    As for stopping spam, it is more difficult. I'd say fix the other problems first, then if you feel up to it, search for 'CAPTCHA'.
    Last edited by redoc; 07-05-2007 at 04:54 PM. Reason: change variable name in code
    PS - this is what part of the alphabet would look like if Q and R were eliminated.


  •  

    Posting Permissions

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