Results 1 to 7 of 7

Thread: PHP Filter on a Form

  1. #1
    Join Date
    May 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default PHP Filter on a Form

    I'm a very novice user with html and php. Website and php form is in place working correctly before i got here. We receive many blank forms or forms with only one field filled out from users that must sit there and click submit. Is there a way to force a pop up when not enough has been filled out. Or if easier block the form from being sent. Thanks in advance. P.S. A filter.txt file is already set up that has a list of bad words in it.

  2. #2
    Join Date
    Apr 2008
    Posts
    15
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    I guess this falls under the category 'form validation'.

    Just google that term. (for example this)

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    PHP happens AFTER it is submitted. Javascript can occur while they are typing on the form.

    Some Javascript form validation scripts are available, so look around. Required fields, etc., fall into that.

    but then of course you'll want a backup PHP script like what was linked above.
    Last edited by djr33; 05-11-2008 at 07:56 PM. Reason: sp
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  4. #4
    Join Date
    Mar 2007
    Location
    Tarboro, NC
    Posts
    290
    Thanks
    8
    Thanked 2 Times in 2 Posts

    Default

    Just curious, is there a specific reason no one has provided him with a simple JavaScript example of this? I was considering it, but then decided to ask if I missed something lol.

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Certainly feel free to post. The original post is vague, asking for a popup and for PHP, so I said he can find something by looking through the DD library (and posts/submissions) if desired.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  6. #6
    Join Date
    Mar 2007
    Location
    Tarboro, NC
    Posts
    290
    Thanks
    8
    Thanked 2 Times in 2 Posts

    Default

    Alright, I will post something in a bit to show off how it could be done with JavaScript, I just wasn't sure if maybe there was something I missed, like maybe he didn't want an actual code. Thanks.
    Wow, I was just reading past posts and man I was a butthole sometimes to people. So if you ever got the end of it, then sorry...

  7. #7
    Join Date
    Apr 2008
    Posts
    38
    Thanks
    9
    Thanked 1 Time in 1 Post

    Default

    If you want to make a popup or related message BEFORE it's submitted, then you shold use a client-side language (most likely JavaScript) for you validation. Otherwise the server will have to deal with processing blank data, and you can't display anything on the same page (usually) or a client-side message (ie pop).

Bookmarks

Posting Permissions

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