Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 20
  1. #1
    Senior Member peezybro's Avatar
    Join Date
    Aug 2011
    Location
    El Cajon, California
    Posts
    229
    Member #
    28822
    Liked
    6 times
    I have been playing around with a contact form for my site and i have not been able to get it to work.

    HTML Code:
            <form action="mail.php" method="post">
        <p>First Name:*<input name="yourname" type="text" size="30" /></p>
        <p>Your Email:*<input name="email" type="text" size="30" /></p>
        <p>Website:<input name="website" value="http://" type="text" size="30" /></p>
        <p>Subject:*<input name="subject" type="text" size="30" /></p>
        <p>Message:*</p><textarea name="comments" onkeyup="return limitarelungime(this, 255)"  cols="35" rows="5"></textarea>
        <br />
        <br />
      <input name="reset" type="reset" value="reset">
        <input name="submit" type="submit" value="submit">
    </form>
    PHP Code:
    <?php
    /* Set e-mail recipient */
    $myemail  "jp.brandon@live.com";

    /* Check all form inputs using check_input function */
    $yourname check_input($_POST['yourname'], "Enter your name");
    $subject  check_input($_POST['subject'], "Write a subject");
    $email    check_input($_POST['email']);
    $website  check_input($_POST['website']);
    $likeit  check_input($_POST['likeit']);
    $how_find check_input($_POST['how']);
    $comments check_input($_POST['comments'], "Write your comments");

    /* If e-mail is not valid show error message */
    if (!preg_match("/([\w\-]+\@[\w\-]+\.[\w\-]+)/"$email))
    {
        
    show_error("E-mail address not valid");
    }

    /* If URL is not valid set $website to empty */
    if (!preg_match("/^(https?:\/\/+[\w\-]+\.[\w\-]+)/i"$website))
    {
        
    $website '';
    }

    /* Let's prepare the message for the e-mail */
    $message "Hello!

    Your contact form has been submitted by:

    Name: 
    $yourname
    E-mail: 
    $email
    URL: 
    $website

    Like the website? 
    $likeit
    How did he/she find it? 
    $how_find

    Comments:
    $comments

    End of message
    "
    ;

    /* Send the message using mail() function */
    mail($myemail$subject$message);

    /* Redirect visitor to the thank you page */
    header(' location: http://www.peezy.comule.com/thankyou');
    exit();

    /* Functions we used */
    function check_input($data$problem='')
    {
        
    $data trim($data);
        
    $data stripslashes($data);
        
    $data htmlspecialchars($data);
        if (
    $problem && strlen($data) == 0)
        {
            
    show_error($problem);
        }
        return 
    $data;
    }

    function 
    show_error($myError)
    {
    ?>
        <html>
        <body>

        <b>Please correct the following error:</b><br />
        <?php echo $myError?>

        </body>
        </html>
    <?php
    exit();
    }
    ?>

    That is my php and html form i am using. My problem is my contact.php page witch holds the form when you click submit it trys to go to mail.php like its a page? is that what it should be doing? After i click submit i go to a 404 error and i do not receive a email. What am i missing?
    "ON TIME, ON TARGET, NEVER QUIT"


  2.  

  3. #2
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,716
    Member #
    5580
    Liked
    718 times
    ... trys to go to mail.php like its a page?
    Do you mean it doesn't execute the PHP script, instead it asks
    to open it like a text file? Not sure what you mean.


  4. #3
    Senior Member peezybro's Avatar
    Join Date
    Aug 2011
    Location
    El Cajon, California
    Posts
    229
    Member #
    28822
    Liked
    6 times
    Quote Originally Posted by mlseim, post: 231738
    Do you mean it doesn't execute the PHP script, instead it asks
    to open it like a text file? Not sure what you mean.
    correct, It wont execute it as a script. Instead it opens the mail.php and it comes up at a 404 saying page is not found.
    "ON TIME, ON TARGET, NEVER QUIT"


  5. #4
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,716
    Member #
    5580
    Liked
    718 times
    You must not have PHP enabled. Is this on your own server?


  6. #5
    Senior Member peezybro's Avatar
    Join Date
    Aug 2011
    Location
    El Cajon, California
    Posts
    229
    Member #
    28822
    Liked
    6 times
    yeh i have php enabled im using 000hosting i think, and using the get simple cms
    "ON TIME, ON TARGET, NEVER QUIT"


  7. #6
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,716
    Member #
    5580
    Liked
    718 times
    Something is wrong ...

    See what happens if you go here:
    http://www.000hosting.com/


  8. #7
    Banned
    Join Date
    May 2011
    Location
    Fairfax, CA
    Posts
    2,036
    Member #
    28003
    Liked
    126 times
    He problably means 000webhost.
    In which case it's total rubbish http://www.000webhost.com/ <-- avoid these scammers at all costs.
    They also run http://www.hosting24.com/ which is the typical lie of "unlimited" everything for $4.84/month...

    Get-Simple CMS is great though, but get a real web host and come back and we'll help you! :P
    By the way, I prefer to use a free downloadable script called Form2Mail you can just Google it
    peezybro likes this.

  9. #8
    Senior Member peezybro's Avatar
    Join Date
    Aug 2011
    Location
    El Cajon, California
    Posts
    229
    Member #
    28822
    Liked
    6 times
    Thanks, yes i did mean 00webhost.com

    I have been using just the free version, I will look for a new host to test my websites out on. Can any of you point me to a good web host that offers everything i need to test a website? and have it be free?

    I will give form2mail a shot and let you guys know how it went.
    "ON TIME, ON TARGET, NEVER QUIT"


  10. #9
    Senior Member peezybro's Avatar
    Join Date
    Aug 2011
    Location
    El Cajon, California
    Posts
    229
    Member #
    28822
    Liked
    6 times
    So i changed my hosting site to 10x witch says they have the sendmail function. I am also using the mail2form script. I am still getting the same problems. When i click submit it trys to go to the mail2form.php like its a page and not a script? Am i missing somthing?

    http://peezybrodesigns.x10.mx/contact

    that is the contact page. (note: None of the links work atm)
    "ON TIME, ON TARGET, NEVER QUIT"


  11. #10
    WDF Staff AlphaMare's Avatar
    Join Date
    Oct 2009
    Location
    Montreal, Canada
    Posts
    4,570
    Member #
    20277
    Liked
    878 times
    Quote Originally Posted by peezybro, post: 232163
    So i changed my hosting site to 10x witch says they have the sendmail function. I am also using the mail2form script. I am still getting the same problems. When i click submit it trys to go to the mail2form.php like its a page and not a script? Am i missing somthing?

    http://peezybrodesigns.x10.mx/contact

    that is the contact page. (note: None of the links work atm)
    Which form2mail script are you using? There is one that requires you to also upload a file called blockip.txt and give it 777 permissions. Without that the form won't get processed.
    Good design should never say "Look at me!"
    It should say "Look at this." ~ David Craib


    http://digitalinsite.ca ~ my current site . . info@digitalinsite.ca ~ my email

    If you feel that someone's post helped you fix your problem, answered your question, or just made you feel better, feel free to "Like" their post. The "Like" link is at the bottom right of each post, along side the "reply" link. And if you are being helped here, try to help someone else - pass it on!


Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 02:31 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com