PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hey,
I have a code on my site which tells the user to enter a 'spam check' number when filling out a contact form.
Basically it only allows one number to be written into the box, any number of my choice.
My question is how can I edit it to allow multiple numbers to be inserted into the box?
you could ask user to enter several numbers comma delimited and then use
explode(',',$spamcheck) and check that all entries in the array matches your multiple numbers.
or u could also use space as a delimiter. whatever suits you.
tomsace wrote:Hey,
I have a code on my site which tells the user to enter a 'spam check' number when filling out a contact form.
Basically it only allows one number to be written into the box, any number of my choice.
My question is how can I edit it to allow multiple numbers to be inserted into the box?
tomsace wrote:Hey,
I have a code on my site which tells the user to enter a 'spam check' number when filling out a contact form.
Basically it only allows one number to be written into the box, any number of my choice.
My question is how can I edit it to allow multiple numbers to be inserted into the box?
tomsace wrote:Hi,
No, I am asking how to allow several different codes to be used. So the user could either use 12354, or 71625, or 93728 etc...
Tom.
Oh. It all depends on how you will determine what values are acceptable. If you just need to have a few values, you could code them in an array and use the function array_search() like this: