Working with two URL variables
Posted: Thu Mar 31, 2005 12:07 pm
Hey!
I have a page, where there is an option to view content in two options (contact sheet, or slideshow). The contact sheet has to be broken into two pages, page1 and page 2
At the minute I've got
As you can see, this will display either "contact" (*.php?view=contact) or "slideshow" (*.php?view=slideshow). However I want the URL to be like this - *.php?view=contact&page=x , so I'll be able to see contact page 1/2 depending on the URL
I've called the URL variable page, but don't have an idea how to work it into the above PHP. I was thinking something like this
Obviously the AND doesn't work, but I hope you get the idea.
Thanks
Conor
I have a page, where there is an option to view content in two options (contact sheet, or slideshow). The contact sheet has to be broken into two pages, page1 and page 2
At the minute I've got
Code: Select all
<?php
// get url varible for view (slideshow/contact sheet)
$view = $_GET['view'];
// get second url variable for page number of contact see
$page = $_GET['page'];
if ($view=="slideshow") {
echo "slideshow";
}
elseif ($view=="contact") {
echo "contact";
}
else {
echo "contact";
}
?>As you can see, this will display either "contact" (*.php?view=contact) or "slideshow" (*.php?view=slideshow). However I want the URL to be like this - *.php?view=contact&page=x , so I'll be able to see contact page 1/2 depending on the URL
I've called the URL variable page, but don't have an idea how to work it into the above PHP. I was thinking something like this
Code: Select all
if ($view=="contact" AND $page=="1") {
echo "contact1";
}
elseif ($view=="contact" AND $page=="2") {
echo "contact2";
}
else {
echo "contact1";
}Thanks
Conor