Contact Form/PHP Script help needed!

22 replies
I posted in the Website Design section earlier, but I think this is area is more relevant. I'm having some issues with contact forms on my website, and I'd really appreciate your input on this!

I have identical contact forms on 2 pages of a website, and both use the same contact.php script to send contact emails to my designated email address.

One of the forms is working, and the other one does not send out contact emails even though both are essentially identical and call the same php script.

I have changed the form ID on the second contact form (the one which isn't working), but it still isn't functioning like it should. What else should I change on the second form in order to make it work?

Thanks,
Paul
#contact #form or php #needed #script
  • Profile picture of the author paulie888
    I'd appreciate it if any of the developers in here could help me with this contact form issue, I'd really like to get this resolved today.
    Signature
    >>> Features Jason Fladlien, John S. Rhodes, Justin Brooke, Sean I. Mitchell, Reed Floren and Brad Gosse! <<<
    {{ DiscussionBoard.errors[2506828].message }}
    • Profile picture of the author xiaophil
      Do you have Firefox?

      Try installing Live HTTP Headers

      That will allow you to see exactly what the forms are posting, and compare them.

      Cheers,
      Phil
      {{ DiscussionBoard.errors[2506855].message }}
  • Profile picture of the author paulie888
    Thanks Phil, but off-hand, do you know how you'd configure two identical forms on two separate pages on your website so that both would submit the same form data?
    Signature
    >>> Features Jason Fladlien, John S. Rhodes, Justin Brooke, Sean I. Mitchell, Reed Floren and Brad Gosse! <<<
    {{ DiscussionBoard.errors[2506925].message }}
  • Profile picture of the author KlikApps
    Originally Posted by jaywilsonjr View Post

    Can you post a link here to the forms?
    Yup, without looking at some kind of code, we won't really be able to help.

    You say they are "essentially" the same... But what exactly is different?
    Signature
    Need a reliable programmer?
    See why Intel flew me across the country and
    paid me $4k for two weeks of programming work...
    {{ DiscussionBoard.errors[2507022].message }}
    • Profile picture of the author paulie888
      Originally Posted by KlikApps View Post

      Yup, without looking at some kind of code, we won't really be able to help.

      You say they are "essentially" the same... But what exactly is different?
      They are identical, just on two different pages - same fields, everything is the same.
      Signature
      >>> Features Jason Fladlien, John S. Rhodes, Justin Brooke, Sean I. Mitchell, Reed Floren and Brad Gosse! <<<
      {{ DiscussionBoard.errors[2507245].message }}
  • Profile picture of the author paulie888
    Ok, here goes, form 1 is on the index page here - http://sneakycpasecrets.com/

    Form 2 (identical fields) is on the Contacts page here - http://sneakycpasecrets.com/index-5.html

    I have tried defining the forms with different names and even attempted calling a different contact.php file (contact1.php), but all that doesn't seem to have worked.
    Signature
    >>> Features Jason Fladlien, John S. Rhodes, Justin Brooke, Sean I. Mitchell, Reed Floren and Brad Gosse! <<<
    {{ DiscussionBoard.errors[2507279].message }}
    • Profile picture of the author xiaophil
      Is the script checking the referring page by any chance?
      {{ DiscussionBoard.errors[2507478].message }}
  • Profile picture of the author paulie888
    No, the script is not checking the referring page, there are no references to the referring pages at all in the script.
    Signature
    >>> Features Jason Fladlien, John S. Rhodes, Justin Brooke, Sean I. Mitchell, Reed Floren and Brad Gosse! <<<
    {{ DiscussionBoard.errors[2507505].message }}
  • Profile picture of the author paulie888
    I can post the contact.php script here, if you'd like to take a look at it.
    Signature
    >>> Features Jason Fladlien, John S. Rhodes, Justin Brooke, Sean I. Mitchell, Reed Floren and Brad Gosse! <<<
    {{ DiscussionBoard.errors[2507520].message }}
    • Profile picture of the author xiaophil
      Originally Posted by paulie888 View Post

      I can post the contact.php script here, if you'd like to take a look at it.
      Sure. PM it if you like, or post it here if you want more eyeballs.
      {{ DiscussionBoard.errors[2507529].message }}
  • Profile picture of the author paulie888
    Here's the basic script, I have been playing around with the parameters on it but to no avail -

    <?
    $subject="lawyer contact: from ".$_GET['your-name1'];
    $headers= "From: ".$_GET['your-email1']."\n";
    $headers.='Content-type: text/html; charset=iso-8859-1';
    mail("emailaddress@gmail.com", $subject, "
    <html>
    <head>
    <title>Contact letter</title>
    </head>
    <body>
    State:
    ".$_GET['your-state1']."
    <br>
    <br>
    Message:
    ".$_GET['your-message1']."
    </body>
    </html>" , $headers);
    echo ("Your message was successfully sent! Thank you.");
    ?>
    <script language="JavaScript" type="text/JavaScript">
    <!--
    window.location.href = "http://www.sneakycpasecrets.com/index.html";
    //-->
    </script>
    Signature
    >>> Features Jason Fladlien, John S. Rhodes, Justin Brooke, Sean I. Mitchell, Reed Floren and Brad Gosse! <<<
    {{ DiscussionBoard.errors[2507542].message }}
    • Profile picture of the author xiaophil
      As it stands that won't work with either form.

      Just remove the trailing '1' from the GET variables and you should be good to go.

      Probably best to redact your email address from the post too.

      Cheers,
      Phil

      P.S. Do you get much spam from that form? Might want to think about a CAPTCHA or something...
      {{ DiscussionBoard.errors[2507562].message }}
  • Profile picture of the author paulie888
    Phil, thanks for the advice regarding the spam issue. I have tried renaming the variables and added the 1 to the end of the original ones, but either way that second form isn't working. How would you configure my current set up, and what would you change on the second contact form (the one on my Contacts page is working, but the one on the index page isn't working)?

    Thanks again,
    Paul
    Signature
    >>> Features Jason Fladlien, John S. Rhodes, Justin Brooke, Sean I. Mitchell, Reed Floren and Brad Gosse! <<<
    {{ DiscussionBoard.errors[2507653].message }}
  • Profile picture of the author paulie888
    Phil, I basically tried to rename the variables and the form on the index page (and even made the form call a contact1.php script instead of the original contact.php) just to see if it would change things. Originally I tried to keep everything exactly the same on the index page as it was on the first form (on the Contacts page), but that definitely didn't work.
    Signature
    >>> Features Jason Fladlien, John S. Rhodes, Justin Brooke, Sean I. Mitchell, Reed Floren and Brad Gosse! <<<
    {{ DiscussionBoard.errors[2507668].message }}
  • Profile picture of the author paulie888
    Quick update - it seems to be working now! I'm not sure what happened as I did NOT FTP anything new to my server over the last 12 hours or so. This is really strange, I did this last night (morning actually) when I was half asleep - I think I really should lay off the programming at 4 am...lol!
    Signature
    >>> Features Jason Fladlien, John S. Rhodes, Justin Brooke, Sean I. Mitchell, Reed Floren and Brad Gosse! <<<
    {{ DiscussionBoard.errors[2507695].message }}
  • Profile picture of the author paulie888
    Just out of curiosity, is there any way that we can do this with just 1 php script? The way I've set it up right now is a little messy - I have two php scripts, one for each identical contact form which is on a separate page on my website. I have also renamed the variables that it passes to the php script, as well as the form IDs. Is there a easier, more organized way of doing this?

    Thanks,
    Paul
    Signature
    >>> Features Jason Fladlien, John S. Rhodes, Justin Brooke, Sean I. Mitchell, Reed Floren and Brad Gosse! <<<
    {{ DiscussionBoard.errors[2507826].message }}
    • Profile picture of the author wattzy
      Don't forget to always use strip_tags when filtering data from forms to avoid malicious data.
      {{ DiscussionBoard.errors[2508230].message }}
  • Profile picture of the author paulie888
    @wattzy - thanks for reminding me about using strip_tags, sometimes when there are ten thousand things to do with a website it's easy to overlook things like this.
    Signature
    >>> Features Jason Fladlien, John S. Rhodes, Justin Brooke, Sean I. Mitchell, Reed Floren and Brad Gosse! <<<
    {{ DiscussionBoard.errors[2518617].message }}
    • Profile picture of the author techgirl
      What capcha are you using for your contact form? Is it safe to use from spamming?
      {{ DiscussionBoard.errors[2518786].message }}
  • Profile picture of the author paulie888
    Haven't implemented Captcha yet, I've been a little lazy about that - any good scripts you'd like to recommend?
    Signature
    >>> Features Jason Fladlien, John S. Rhodes, Justin Brooke, Sean I. Mitchell, Reed Floren and Brad Gosse! <<<
    {{ DiscussionBoard.errors[2543546].message }}
  • Profile picture of the author ar.anandan
    hey try this.

    rename the file from index5.html to index5.php

    as you have used get functions this may surely solve your problem.
    check it and let me know.


    regards
    anuradhan
    Signature
    PHP programmer - Web Designer - Customization - XFileSharingPro - wordpress - joomla - vbulletin - phpbb - phpfox - all phpscripts
    OruTube - Tamil Dubbed Movies
    Skype : ar.anandan Yahoo! : ar.anandan
    {{ DiscussionBoard.errors[2545209].message }}

Trending Topics