Hi,
I’m pretty much of a beginner, and that may be why I’m having difficulty phrasing my question in such a way that search results for answers turn up anything useful!
Anyway, here’s the question: I have a Wordpress site that has a section that is only available to “Certified Trainers”. These Certified Trainers have to enter their Certification Number when they register for the site, and I need code that checks to see if the number they enter is valid, i.e., it’s a number that my client has actually assigned to a real Certified Trainer.
I’ve managed to write php code that does this nicely as a test, in which I simply entered example numbers (1,2,3,4) into an array of “valid numbers”. However, there are hundreds of real Certification Numbers, and they’ve been more or less randomly assigned (i.e., I can’t set it up to say “any number between 100 and 200 is okay”); I actually need to have the array refer to a list of several hundred numbers.
It seems very unwieldy and inelegant, to say the least, to make an array which actually includes all those numbers, and to which I’ll have to manually add a number every time a new Trainer is Certified. What I’m imagining as a solution is a separate list of numbers that the array will be able to check upon execution of the code… that way as long as the list is kept up to date, the code will work.
Here’s what I have so far:
[php]
FYI, the variable ‘first’ is referring to the fact that this code only needs to be run the first time the user sees this page, i.e., right after they register for the site; and I’m using the S2member plugin for Wordpress for registering users, which is what all those references are about, for anyone who’s not familiar with it.
If anyone can help me figure this out, I’d appreciate it!