|
-
Jul 31st, 2006, 10:19 PM
#1
Thread Starter
PowerPoster
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.
-
Jul 31st, 2006, 11:11 PM
#2
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.
-
Aug 1st, 2006, 09:03 AM
#3
Addicted Member
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.
-
Aug 2nd, 2006, 01:08 AM
#4
Thread Starter
PowerPoster
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|