Website Contact form troubles. : /

Discussion in 'PHP' started by Sylinic, Oct 7, 2014.

  1. #1
    Hi guys, I'm new to this forum, but I plan on staying a while. The "Advertising Y U NO DO IT" pic really captured a special place in my heart.

    So! My website's contact form is not working for me, and I was hoping someone here could shine some insight into my problem.

    This is all the code.

    _____________________________________________________________________
    From : Contact.html

    [​IMG]
    ____________________________________________________________________
    From : Send.php

    [​IMG]

    _________________________________________________________
    From : Config.php

    [​IMG]
    _____________________________________________________________________
    From: Cpanel

    [​IMG]

    Thank you kindly in advance, having somewhere to turn where people graciously offer their help for free is pretty amazing.
     
    Solved! View solution.
    Sylinic, Oct 7, 2014 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,893
    Likes Received:
    4,553
    Best Answers:
    123
    Trophy Points:
    665
    #2
    Which bit is not working? is the ajax firing and calling the php script? Is the email being sent but with wrong info?
    What debugging have you done?
     
    sarahk, Oct 7, 2014 IP
  3. Anveto

    Anveto Well-Known Member

    Messages:
    697
    Likes Received:
    40
    Best Answers:
    19
    Trophy Points:
    195
    #3
    You might not want to post your password here :)

    Anyways since you don't say how it's not working it is hard for us to guess what the problem might be. if your Send.php file uses a capital S then use the capital S in action="form/send.php".

    Could it be the mailserver that is not letting you send from a spoofed email? ? or did you forget to even set the receiver email ? I assume you don't own either of these email adresses :)
     
    Anveto, Oct 8, 2014 IP
  4. Sylinic

    Sylinic Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #4
    Hi Sarah and Markus!

    It must be pretty clear here how inept I am when it comes to programming. xP

    http://sylinic.com/contact.html is my contact page.

    When you try to send an E-mail, it should either display the confirmation or error message with javascript. As in it'd collapse the section and re-open with "Thank you, I will contact you shortly." or "Unfortunately I couldn't deliver your message. Please try again later." But it doesn't do anything, it just reloads the page displaying no message. It doesn't send anything to my website, and I don't know how to test if the ajax is firing and calling the php script.

    I'm not sure how to go about troubleshooting, I tried turning on debugging with,

    "$debug = true; //if problems occur, set to true to view debug messages", but it doesn't seem to return and information on why it's not sending, or I just don't know where it's displaying it. xd Although the files and links are all lowercase, just when I labeled them in my original post I uppercased them.

    Doh, I did forget. I changed the send address to my E-mail, but the "" for the from address, wouldn't that differ with every client E-mail?

    "//to send mail from contact form or book a table table to a different email just copy those two lines and paste below
    //require_once "config.php" in send.php or table.php

    $mail->SetFrom('', 'First Last'); //from address
    $mail->AddAddress("", "Sender Name"); //where to send email"

    P.s. - Haha Markus I noticed I forgot to black the password out after I exported from Photoshop, I had to change the password anyway because that one was pretty puny.
     
    Sylinic, Oct 8, 2014 IP
  5. #5
    Well you haven't added any confirmation, you just submit the form which reloads the page if there are no errors.

    
    $('form.form-search').submit(function () {
    $(this).find('input, textarea').trigger('blur');
    var errors = $(this).find('.error').length;
    /*** no errors - submit form ***/
    return errors == 0;
    });
    
    Code (markup):
     
    Anveto, Oct 8, 2014 IP
    sarahk likes this.
  6. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #6
    Wow. There are... so many things wrong here.
    First of, use [ code ] (remove the spaces) to encase code on the forum. Fuck the colorcoding-crap.
    Second, the form itself isn't properly formed - the inputs doesn't have a name="" property (unique for each input)
    Third, doing validation only in javascript? That just begs for malformed mails, spam, etc. You need to do validation on the server-side as well.
    Fourth, you're not stopping the form executing the standard action (posting to form/send.php) what I can see - unless you're returning false or doing a preventDefault() on the ajax-call, you're gonna post it the regular way, and any javascript won't show up, simply because the page has reloaded. (I might have missed the return false call, the code wasn't that easy to read)
     
    PoPSiCLe, Oct 8, 2014 IP
    sarahk likes this.
  7. Sylinic

    Sylinic Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #7
    Thank you Markus, I'm going to go about figuring out how to implement this into the code, haha. I appreciate the help, and could only imagine how sore your face and palm are from this thread. :rolleyes:

    I'll report back soon.

    Hey PoPSiCLe, I appreciate the honestly, one of the best motivators to improve is tough love, and I didn't know about using brackets to do that, thanks for the heads up. I really am absolutely clueless when it comes to server side programming and PHP, I have been mainly focusing on Web Design with HTML and such, I just need to get this form functional and like you said secure so bots don't spam me. This contact form is from and Envato sale, I didn't make it, but if it really is that insecure, would you be open to writing up a proper script to get this functional? I'd happily pay your rate. This offer is too anyone capable and interested.

    P.s. - I eventually want to be properly learn server side languages like PHP, but right now I'd be spreading myself to thin, I'm still learning HTML5 and basic javascript.

    Thanks guys, I really do appreciate the effort to help such a noob.
     
    Sylinic, Oct 9, 2014 IP