Shew,

http://www.whirledweb.com/phptest/InsertPicks3.php

It looks like the issue here is Capitalization.  PHP is very capitalization
sensative. (which I believe that Cold Fusion is less picky about) And your
code looks great, save a couple little issues that may have made it even
more confusing.  :-)

1.  the concatenation character in PHP is the "." not "+", so line 45 or so
was having issues (it was literally adding "Game" to the contents of the
variable... so it gave odd output results.)  This also messed up your
concatenation at about line 54.

2.  (this is pretty arbitrary) The HTML input tag doesn't need a closing
tag.  I do think however, you can make it XML compliant by writing it this
way: <input type="text" name="name" value="value" />    The closing slash
shows that there is no closing tag needed. (not sure why one would need to
make it XML compliant...)  I'm not an expert in this specific little area,
so somebody with a bigger brain on this list might clear that up.

3.  Then, there are several capitalization inconsistencies.  The variable
name in your form is "game1" but then you were checking for "Game1"...
except in your $_POST function, where you went back to all lower case.  I
cleaned that up, and it seems to work great now.

I hope some of this helps!
-Mark


>
> Thanks. I understand. I'm actually a Cold Fusion programmer.
>
> I've tried what you suggested but can't seem to get it work -
> code attached.
> However, I can display the radio button if I use the $_POST function.
>
> I'm not sure if it's the version of php I'm using. Stats -
> windows 2000 Sp1,
> Apache 2.039, php 4.2.2.
>
> Thanks for taking the time!!
>
> "Mark Middleton" <[EMAIL PROTECTED]> wrote in message
> [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> > It looks like your code could use "variable variables" to help you out.
> >
> > ::::::::::: OLD CODE ::::::::::::::::
> >
> > > > for ($GameIdx = 1; $GameIdx <= 17; $GameIdx++) {
> > > >  /* instead "hardcoding each radio button name - just do it
> > > programmatically
> > > > by concatenating / creating the name */
> > > >  $frmGame = "Game" + $GameIdx;
> > > >  if ($frmGame) {
> >
> > ::::::: END OF OLD CODE :::::::::::::
> >
> > ** this check will always be true - because you just set
> $frmGame equal to
> a
> > value... ***
> > What you want to do at this point is use variable variables (where the
> > variable name is actually
> > a variable itself.
> >
> > ::::::::: NEW CODE :::::::::::
> >
> > > >  $var_frmGame = "Game" + $GameIdx;
> > > >  $frmGame = $$var_frmGame;   // The "$$" is used for variable
> variables
> > > >  if ($frmGame) {
> >
> > :::::: END OF NEW CODE :::::::
> >
> > ** the above snippett is was I wrote to show the results of the dynamic
> > (looped-through) variable $Game1, $Game2, ...
> >
> > I use this method when the number of form elements is variable.  Instead
> of
> > hardcoding the number "17" you might make a variable in the
> incoming form
> > with the count of form elements (simply increment a variable with each
> > printing of the form variable... then at the end of the form make <input
> > type="hidden" name="elementcount" value="$count">)
> >
> > Then you can make the above for-statement look like this:
> >
> > > > for ($GameIdx = 1; $GameIdx <= $elementcount; $GameIdx++) {
> >
> > Does any of this make sense or help in any way?
> >
> > -Mark
> >
> >
>
>
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to