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 11
  1. #1
    Senior Member RDesignista's Avatar
    Join Date
    Feb 2012
    Location
    Coconut Tree City
    Posts
    822
    Member #
    30921
    Liked
    123 times

    What are your must haves for PHP contact forms?

    Hi,

    I hate contact forms. Everything about making them is not fun. It's to the point that I use WUFOO or JOTFORM or Wordpress plugins so that I don't have to deal with them.

    But I really want to create a great framework I can use again and again. Furthermore, I want more control over the CSS. I already have a framework, sort of, but I'd like to make it even better. So I'm asking you all today: what are your MUST HAVES for PHP contact forms?

    What I have:
    • frontend validation (via HTML5)
    • frontend HTML5 input field types (ex: <input type="number">) for smart touch keyboards
    • backend checks for inputted fields (PHP isset + PHP died)
    • backend string validation (PHP preg_match)
    • backend clean_string (don't know why I have this)
    • echo out a thank you message


    Some things that are on my mind:
    • a database that logs all submissions (via SQL?)
    • AJAX no-refresh submission (also, don't need to create a thank you page)
    • some way to further validate my emails so that they don't get rejected or end up in spam folders (which I have been very frustrated with)


    Would love to hear what you folks think. Thank you.

  2.  

  3. #2
    Senior Member RDesignista's Avatar
    Join Date
    Feb 2012
    Location
    Coconut Tree City
    Posts
    822
    Member #
    30921
    Liked
    123 times
    One more thought: when sending the mail, is it safe to do HTML email to style the submissions? I tried it once, was fine on my Gmail, but blocked by a client's business Yahoo mail. So I reverted back to text only.

  4. #3
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,485
    Member #
    425
    Liked
    2783 times
    Yahoo! Mail is a beast to figure out all by itself. You can send the same email ten times and run into ten different mail servers with ten different spam blocking configurations. I ended up spending $340 back in 2011 on a mail server upgrade just so I could get Domain Keys installed, which was the only way I could get through to Yahoo! So that, or something similar, may be how you have to solve Yahoo! (Side note: I keep hearing Apple's going to buy Yahoo!, which shows how out-of-touch Apple is since the company's a shell of what it was in the mid-to-late 90's). In other words, I don't think an HTML email was your problem.

    With that said, and I hate to say this because it's not really what you asked, you may want to look into ASP.net if you don't like building forms. ASP.net has some of the more common validators built in (required field, range, comparing to another string, regular expression) and if you need to custom validation as well.

    Types of Validation for ASP.NET Server Controls

    The .NET validators use Javascript where / when possible with server-side code to back them up, so you don't have to do much other than put in the validators (which is one line of code), add Page.Validate to your code-behind, and do some CSS to style the DotNetValidatorLine class .NET generates.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  5. #4
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    You're missing spam submission blocking. I generally use a honeypot setup where I hide a field from the user's view and kill the submission if there's anything in it. I wrote an article on my site on how to do it in Wordpress, but the concept would work anywhere.

    For the CSS, if you're using a preprocessor like Sass, it'd be easy to make a reusable form mixin that you could include that has generic styles for the form. Of course, you could probably just @include a plain CSS sheet to do the same thing if you prefer that.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  6. #5
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,686
    Member #
    5580
    Liked
    716 times
    The honeypot idea does work good.

    At the beginning of your page, enter a form that does nothing and comment it out so it doesn't show.

    Put your real form after the fake one.

    Spamming robots see the first form and hit it. Then they are done and move on to the next website. They can't tell that the form is commented-out

    Code:
    <!-- commented-out form -->
    <!--
    <form action="http://www.google.com" method="post">
    Enter email: <input type="text" name="email">
    <input type="submit" name="submit" value="Add My Email">
    </form>
    -->


  7. #6
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    I hadn't thought to do it that way. I usually add an input field to my existing form, and just do a quick if statement that dies if it's set and I hide it wIth CSS. I suppose either work just as well. Took the comment spam on my site from 40+ per day down to 3 in 4 months.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  8. #7
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,485
    Member #
    425
    Liked
    2783 times
    I'm developing something similar to what Ron is talking about, except that it will go a little beyond just "dying". Basically, if you attempt to use the honeypot on the blog platform I'm creating (I'm down to building the admin now for v. 1) you'll get locked out of my entire server. Just to make it more tempting, I'm calling it "Comment" and then giving the actual comment field a variable field name that will be stored in a configuration file. Mind you, you have to be a real sick, twisted bastard to even attempt something like that...and well, I'm a sick, twisted bastard.

    Max: your idea may not work on some (read: most) ASP.net sites as by default you're allowed one server-generated set of form tags, although you can add other non-server-generated forms outside of the form tags. By default, most .NET code editors set up a master file to look something like this:
    Code:
    (all your head stuff I don't feel like replicating)
    <body>
    <form runat="server">
    <div>
    asp placeholder tags for content on the page here.
    </div>
    </form>
    </body>
    </html>
    The runat="server" is unique to ASP.net and allows you to include input fields and validation controls such as the ones I talked about earlier.

    Now, you can put the comment form field elsewhere and it's not a bad idea just to have bots fill them out and trap themselves. It just won't work inside of the .NET form tags, that's al.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  9. #8
    WDF Staff mlseim's Avatar
    Join Date
    Apr 2004
    Location
    Cottage Grove, Minnesota
    Posts
    7,686
    Member #
    5580
    Liked
    716 times
    It would be fun to have a hidden form that actually took someone on a journey through fake web pages ... not for robots, but for people that view HTML source and try to toy-around with form stuff. It's a shame that we have to even be talking about spammers and robots. The internet is turning into sh*t.


  10. #9
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,485
    Member #
    425
    Liked
    2783 times
    "Turning into" sh*t? Large portions of it have been there for years. That's why Facebook still exists even though it's a giant house of cards with an impending implosion that can be seen from space.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  11. #10
    Senior Member RDesignista's Avatar
    Join Date
    Feb 2012
    Location
    Coconut Tree City
    Posts
    822
    Member #
    30921
    Liked
    123 times
    Interesting ideas.

    ASP.net. I've heard of it. Never seen it in action. I hear it's an older technology by Microsoft. That's all I know. I'll Google it later.

    Honey Pot. That's important and I forgot! I get spoiled because Wordpress form plugins usually do a good job of spam control. I like the comment out idea. That plus honey pot field would be great for repelling bots.

    As for spambots, I got careless and filles out a form when I was looking for insurance quotes (it was a Google ad) and my email inbox has been crap since. Used to get maybe 20 a month, now I'm getting 400, really because of that one site. I wish I could create a tool that would find the registrant of the domains sending the spam, take down their emails, and then spam them mercilessly as revenge.

    As for the internet turning into ****, well, it's the old economics idea of "guns and butter" -- it's a pity we have to spend time worrying and fighting spam, scammers, and trolls (the guns) because we could spend that time actually growing the internet (the butter), but it's all necessary.


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 05:05 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com