I have defined a var to be used in my forms and it grabs all the parameters automatically so that i dont have to check for them. problem is how do i count the values inside
HTTP_SERVER_VARS[‘QUERY_STRING’] ?
when i do var_dump i see string(0) “” when I have no params but when i do it beings string(#) where # is the num of params. I have tried count() but it shows a value of 1 no matter how many params i put.
this is what i have set up.
define('PHP_SELF', htmlentities($_SERVER['PHP_SELF']) . "?". $HTTP_SERVER_VARS['QUERY_STRING']);
this is how i use it.
<form method="POST" action="<?= PHP_SELF ?>">
....
</form>
my problem is even if there are no params the action looks like /page.php? and I want to check against the params so if no params are set then i can take out the ? mark. How would i do this?
let me know you understand what im trying to say.
You can use this:
or maybe you can do this (more simple):