[colug-432] PHP code question?
Rob Funk
rfunk at funknet.net
Mon Dec 21 10:50:15 EST 2015
Vince Herried wrote:
> I have a set of buttons for each letter of the alphabet
> .
> .
> <a href="{_SERVER['PHP_SELF']}?_letterA">F</a>
> <a href="{_SERVER['PHP_SELF']}?_letterB">G</a>
> <a href="{_SERVER['PHP_SELF']}?_letterC">H</a>
Can you change it to say something like "?_letter=A", so you can just
check one variable?
> I would rather not write 26 if statements such as
> if (isset($_GET['_letterA'])) {
Use $_SERVER['QUERY_STRING'] to get your value, then you can parse
from there.
This is a case when the output of phpinfo() is really useful. So is a
list of the standard CGI variables, or PHP's list of server variables:
http://php.net/manual/en/reserved.variables.server.php
More information about the colug-432
mailing list