Re: Re: REQUEST QUESTION
| From: | karthikeyan | Date: | Tue, 05 Mar 2002 19:42:41 +0000 |
| Subject: | Re: Re: REQUEST QUESTION | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-87340@lists.php.net to get a copy of this message | ||
Hi All,
I have worked in Java and Cgi and there I was able to do this very easily.
Infact i have one solution to this using GET method in PHP but I want this
using POST.
Here is the PHP Solution using GET to get 2 values with same NAME.
---------------
$ar=explode('&',$QUERY_STRING);
foreach ($ar as $stritem)
if(substr($stritem, 0, 5) == "order") {
$ordervalue = substr($stritem, 6);
echo "\n<input type=\"hidden\" name=\"order\"
value=\"" .
urldecode($ordervalue) . "\">\n";
}
}
--------------
Looking forward for further comments on this subject.
Regards,
karthikeyan.
----- Original Message -----
From: SHEETS,JASON (Non-HP-Boise,ex1) <jason_sheets@non.hp.com>
To: 'karthikeyan' <karthikeyan@aspiresys.com>
Sent: Wednesday, March 06, 2002 12:18 AM
Subject: RE: [PHP] Re: REQUEST QUESTION
>
> Hello,
>
> Without changing the name of the variables or using an array you can't
> retrieve both values. The reason is that one overwrites the other, for
> example
>
> <input type="hidden" name="order" value="10">
>
> at this point the value of order is 10
>
> <input type="hidden" name="order" value="20">
>
> at this point the value of order is 20
>
> You can't have one variable have two values unless it is an array.
> Unfortunately you are going to have to have the form changed to either use
> the
>
> <input type="hidden" name="order[1]" value="10">
> <input type="hidden" name="order[2]" value="20">
>
> method or use
>
> <input type="hidden" name="order1" value="10">
> <input type="hidden" name="order2" value="20">
>
> I would recommend the first because it is cleaner.
>
> Hope this helps,
>
> Jason
> -----Original Message-----
> From: karthikeyan [mailto:karthikeyan@aspiresys.com]
> Sent: Tuesday, March 05, 2002 10:42 AM
> To: php-general@lists.php.net
> Cc: David Tandberg-Johansen
> Subject: Re: [PHP] Re: REQUEST QUESTION
>
>
> Hi Thanx,
>
> -----------
> > <input type="hidden" name="order [1]" value="10">
> > <input type="hidden" name="order [2]" value="20">
> >
> >
> > On the nest page you just do
> >
> > echo "The first order is ".order[1]." and the second order is
".order[2];
> ----------
>
> But that is what I cannot do. I cannot change the name of the order to
> order[1] because that form is not in my control.
>
> I want both the order with its values.
>
> Any other suggestions please.
>
> Regards,
>
> karthikeyan.
> ----- Original Message -----
> From: David Tandberg-Johansen <david@datajo.no>
> To: <php-general@lists.php.net>
> Sent: Tuesday, March 05, 2002 10:09 PM
> Subject: [PHP] Re: REQUEST QUESTION
>
>
> >
> >
> > "Karthikeyan" <karthikeyan@aspiresys.com> skrev i melding
> > news:002601c1c461$cfa08580$0600a8c0@aspire006...
> > Hi Guys,
> >
> > I allready posted this question in detail but I believe I didn't
explain
> > it properly.
> >
> > There are 2 hidden variable in my FORM.
> >
> > 1. order = 10 and 2. order=20
> >
> > I want to retrieve both the orders in the next page say somename.php.
> How
> > do i do that.
> >
> > Regards,
> >
> > karthikeyan.
> >
> > You must put the in a array like this
> >
> > <input type="hidden" name="order [1]" value="10">
> > <input type="hidden" name="order [2]" value="20">
> >
> >
> > On the nest page you just do
> >
> > echo "The first order is ".order[1]." and the second order is
".order[2];
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>