Results 1 to 4 of 4

Thread: Form Submit Q

  1. #1

    Thread Starter
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Resolved Form Submit Q

    I have a form where the user can input a number of share codes (seperated by ,) into a textarea. When the user then clicks the submit button I want to be able to check the share codes entered against a "master" list of share codes I have in an array (using in_array()). If any share codes entered by the user aren't in the master array then I want to display a message of all share codes that were not found.

    Can this be done using PHP or would I have to try and use Javascript?
    Last edited by lintz; Aug 1st, 2006 at 01:04 AM.

  2. #2
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: Form Submit Q

    You can use AJAX, which is a mixture of Javascript and PHP. Have a look at the article in my signature which has an example.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  3. #3
    Addicted Member
    Join Date
    Jul 2003
    Posts
    255

    Re: Form Submit Q

    He said after the user clicks submit.

    What I would do is explode the string of the codes (with "," as the delimiter), and then foreach() through the master list, checking input codes with in_array() (I'd also clean them with strtolower()/strtoupper() and trim()). If the in_array() result is false, add the inputted item to a third array, and then handle your output with that.

  4. #4

    Thread Starter
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Lightbulb Re: Form Submit Q

    Thanks Rabbit, that is what I ended up doing

Posting Permissions

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



Click Here to Expand Forum to Full Width