NYCPHP Meetup

NYPHP.org

[nycphp-talk] passing variables to the next php page - HELP

Néstor rotsen at gmail.com
Thu Aug 10 16:49:01 EDT 2006


TNX!!!!

that iw hat I was looking for.  I had done something like this
about 3 years ago but I could not remember, but I new it could be done.


Thanks again to all,

Néstor :-)

On 8/10/06, Rob Marscher <rmarscher at beaffinitive.com> wrote:
>
> switching the single quotes to double quotes should work also:
> $query .= ",;" . $_POST["bid_sub_desc$i"] . ":";
>
> PHP expands variables enclosed in double quotes but leaves everything as
> is if enclosed in single quotes.
>
> -Rob
>
>
> Ken Robinson wrote:
> > At 03:39 PM 8/10/2006, Néstor wrote:
> >> People,
> >>
> >> In one PHP page I have an input field name
> >> bid_sub_desc0, bid)sub_desc1, etc...
> >> Whe I am in my next PHP page I am try to move
> >> the different values to single variable
> >> to later added it a query.  bid sub tell me how many bids  where
> entered.
> >>     for($i=0; $i < count($bid_sub); $i++)
> >>     {
> >>       $query .= ",;" . $_POST['bid_sub_desc$i'] . ":";
> >>     }
> >>
> >> When I print print "QUERY =$query|<br>\n";
> >> I get nothing :
> >>   QUERY=,':','::')|
> >>
> >> The varable inside the $_POST is no getting refered to the way I want
> it to.
> >> I was expecting the bid_sub_desc$1 to change to:
> >> bid_sub_desc0
> >> bid_sub_desc1
> >> etc
> >> depending on the $bid_sub
> >
> > Your problem is occurring because you're enclosing the index in single
> quotes.
> > Change
> > $query .= ",;" . $_POST['bid_sub_desc$i'] . ":";
> > to
> > $query .= ",;" . $_POST['bid_sub_desc'.$i] . ":";
> >
> > If you can change the names on the form to
> > arrays, it would make your life much easier. Then
> > instead of checking for $_POST['bid_sub_desc'
> > .$i], you could use $_POST['bid_sub_desc][$i]
> >
> > Ken
> >
> > _______________________________________________
> > New York PHP Community Talk Mailing List
> > http://lists.nyphp.org/mailman/listinfo/talk
> >
> > NYPHPCon 2006 Presentations Online
> > http://www.nyphpcon.com
> >
> > Show Your Participation in New York PHP
> > http://www.nyphp.org/show_participation.php
> >
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20060810/8b7a1f4d/attachment.html>


More information about the talk mailing list