[thelist] building a dynamic variable in php
David U.
davidu at everydns.net
Mon Jan 13 11:56:00 CST 2003
Tom:
What your doing doesn't make sense because you already have $_POST but I
don't know your whole scope.
Either way:
for ($i = 0; $i < 10; $i++) {
$mail[$i] = $_POST[$i];
}
will put it into an array which is easier (despite the fact that it is
already in an array, and this pointless)
or you could do something like:
list ($to, $from, $subject, $body, etc) = $_POST;
I don't recommend either way, but that's not really the point I suppose...
-davidu
Tom Dell'Aringa wrote:
> Hello,
>
> I'm building a 'mail to friend' list where I have 10 form fields
> labeled 1 through 10. In my php that processes the page, I thought
> instead of doing:
>
> $mail1 = $_POST["1"];
>
> I would instead run through a loop to do it:
>
> for($i = 1; $i <= 10; $i++) {
>
> then I would dynamically set each variable. This was what I tried:
>
> $mail . i = $_POST[i];
>
> but this of course did not work. There must be a good way to do this
> I would think...
>
> Tom
>
> =====
> var me = tom.pixelmech.webDeveloper();
>
> http://www.pixelmech.com/
> http://www.maccaws.com/
> [Making A Commercial Case for Adopting Web Standards]
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
More information about the thelist
mailing list