-
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?
-
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.
-
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.
-
Re: Form Submit Q
Thanks Rabbit, that is what I ended up doing :thumb: