Re: Stupid question
| From: | Johannes Janson | Date: | Mon, 09 Jul 2001 10:47:17 +0000 |
| Subject: | Re: Stupid question | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-10177@lists.php.net to get a copy of this message | ||
Hi,
>1. I have checkbox NAME="x" on Page1.
>2. On page two I want to check ($x) if it's checked or not. How can I do
it.
>3. What value is stored in $x.
PHP makes a variable out of every form element. You don't need to do a
thing.
So assuming this is within <form> and </form> tags:
<input type="checkbox" name="x"> you can check on the action page of the
form if "x" is checked by isset(). So if(isset($x)) { ... } would be
checking it.
If you don't give the checkbox a value it will be "on" if checked and
nothing
or "0" if not checked.
You can always check the submitted values by this little script:
while (list($key, $value) = each($HTTP_POST_VARS)) {
echo "$key: $value<br>";
}
hope it helps
Johannes