Re: Anyone Up?
| From: | Luke Welling | Date: | Fri, 01 Feb 2002 07:22:55 +0000 |
| Subject: | Re: Anyone Up? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-83070@lists.php.net to get a copy of this message | ||
"Jtjohnston" wrote:
> Anyone Awake? Up?
It is 6:17 pm. I would have trouble sleeping at this time of day :)
> I'm using 12 checkboxes
>
> <INPUT TYPE="checkbox" NAME="Check1" VALUE="Your Name">
>
> dynamically generated by mysql. Each has an id as primary index so I do
> this:
>
> <INPUT TYPE=\"checkbox\" NAME=\"Check".$mydata->id."\"
> VALUE=\"".$mydata->yourname."\">
>
> When I submit, I want to echo to see if anyone clicked on them. But I
> can't get my variable right to find $check1 through $check12. How do I
> express in a for loop. $Check.$i does not work of course!
There are two ways I can think of.
1) You could change the way that your code creates the checkbox names, so
that rather than getting 12 variables, you get an array with 12 elements.
2) You could repeat your MySQL query on the echo page, and loop though code
something like this:
$varname = "Check".$mydata->id;
echo $$varname;
Good Luck.
Luke Welling.
--
PHP and MySQL Web Development
by Luke Welling and Laura Thomson
http://www.amazon.com/exec/obidos/ASIN/0672317842