This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > Dreamweaver > February 2006 > Re: passing multiple url parameters
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Re: passing multiple url parameters
|
|
| Gary White 2006-02-12, 6:28 pm |
| On Wed, 8 Feb 2006 03:06:08 +0000 (UTC), "Marty Thomas"
<webforumsuser@macromedia.com> wrote:
>I am trying to retrive multiple URL parameters. The URL that is passed looks
>like: "selected.php?ID=1&ID=3&Submit=Send"
>
> I would like selected.php to show all of the different IDs that were selected.
> Currently, I can only see the last URL parameter. So for the above example, I
>would only see that the user selected ID3.
Since they have the same name, you can only access one of them. You can
either name them all differently, or you can name them as an array, i.e.
name="ID[]" and PHP will treat them as an array. You would then need to
concatenate the array elements into a string, perhaps something like
this:
$query="SELECT * FROM sometable WHERE ID IN (".
join(",",$_GET['ID']). ")";
Gary
| |
| Marty Thomas 2006-02-12, 6:34 pm |
| I am fairly new to PHP, and any programming for that matter, so I appreciate
your time and patience.
I would place the code you provided that concentrates the array elements in
the the selected.php page correct?
The result would then be to have each URL element to have a unique name,
correct? Such as ID0, ID1, ID2.
Thanks again
| |
| Gary White 2006-02-12, 6:35 pm |
| On Wed, 8 Feb 2006 23:32:18 +0000 (UTC), "Marty Thomas"
<webforumsuser@macromedia.com> wrote:
> The result would then be to have each URL element to have a unique name,
>correct? Such as ID0, ID1, ID2.
Here's a slightly more elaborate example:
http://testing.apptools.com/marty.php
Gary
|
|
|
| | Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |
|