Skip to main content
Participant
July 25, 2007
Question

Passing multiple ID's in URL variable

  • July 25, 2007
  • 1 reply
  • 538 views
How can I show results from a mysql database from selected ID's using URL variables?
Showing results from one ID works fine:
mypage.php?id=1
But,
My table has 10 rows and I want to show 3 of those rows:
mypage.php?id=1&id=3&id-4

Thanks for a point in the right direction.
This topic has been closed for replies.

1 reply

Inspiring
July 25, 2007
.oO(RGNelson)

>How can I show results from a mysql database from selected ID's using URL
>variables?
> Showing results from one ID works fine:
> mypage.php?id=1
> But,
> My table has 10 rows and I want to show 3 of those rows:
> mypage.php?id=1&id=3&id-4

Change the name of the form control from "id" to "id[]". This will turn
$_GET['id'] into an array, where you can find all selected IDs.

Micha
RGNelsonAuthor
Participant
July 25, 2007
Thanks for working with me on this!
Where do I put the brackets?
I'm not using a form.
I'm using a link;
mypage.php?id=1&id=3&id-4

These don't work for me:
mypage.php?id[]=1&id[]=3&id[]=4
mypage.php?id=1[]&id=3[]&id=4[]

Do I need to put the brackets in my recordset?

Thanks for the help 8–)