RE: [PHP-DB] Re: problems with variables
| From: | Ford, Mike [LSS] | Date: | Tue, 04 Feb 2003 17:53:12 +0000 |
| Subject: | RE: [PHP-DB] Re: problems with variables | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-25431@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Mark [mailto:mark_weinstock@yahoo.com]
> Sent: 04 February 2003 14:38
>
> Just a quick correction... if the "q" part is static, I believe you
> should use $(q$i) rather than ${$q . $i}
Well, actually, I think you want ${'q'.$i} -- or even ${"q$i"}
Cheers!
Mike
---------------------------------------------------------------------
Mike Ford, Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS, LS6 3QS, United Kingdom
Email: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211
> --- no-spam----me@larrykagan.com wrote:
> > OK, now I get it:
> >
> > $input = '<input type="hidden" name="q' . $i . '"
> > value="' .
> > ${$q . $i} . '">" . "\n";
> >
> > print($input);
> >
> > This one isn't well known so don't forget it!! ;)
> >
> > Larry
> >
> >
> > Marcel <m.h.a.reuvekamp@student.utwente.nl> wrote:
> > > Sorry, I see that I've got the a's and q's mixed up.
> > > I'll try to clarify it some more by giving an example with 2
> > variables.
> >
> > > $q1 = "first_var";
> > > $q2 = "second_var";
> > > for($i=1;$i<=2;$i++)
> > > {
> > > echo "<input type=\"hidden\" name=\"q$i\"
> > > value=\"$q$i\">\n";
> > > }
> > > The output should now be:
> > > <input type="hidden" name="q1" value="first_var">
> > > <input type="hidden" name="q2"
> > > value=\"second_var">
> >
> > > Hope you can help me,
> > > Marcel
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
> =====
> Mark Weinstock
> mark_weinstock@yahoo.com
> ***************************************
> You can't demand something as a "right" unless you are
> willing to fight to death to defend everyone else's right to
> the same thing.
> -Stolen from the now-defunct Randy's Random mailing list.
> ***************************************
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>