Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

Multiple variables in get query string

General discussions related to php

Moderators: macek, egami, gesf

Multiple variables in get query string

Postby BenSeagrave » Wed Sep 05, 2012 4:08 pm

I'm trying to make my website so that when you click on a link it changes the dynamic include to the specific page. It's hard to explain so I'll just show you.

The website I'm making is for a tattoo studio, if you go to http://www.btseagrave.co.uk/ink/index.php?p=artists, you can see the two image links for "Bianca Seagrave" & "Bryan Baford". Currently because of the index.php?p=artists, the index is including the artists.inc.php page, but when they click on either bianca or bryan, the url changes to index.php?p=artists&artist=bianca(or bryan) I want it to include bianca.inc.php or bryan.inc.php. I've tried doing something like this:
Code: Select all
if(isset($_GET['artist']) {
    $artist = $_GET['artist'];
    if($artist = "bianca") {
        include(bianca.inc.php);
    } elseif($artist = "bryan") {
        include(bryan.inc.php);
    }
} else {
    echo "DEFAULT ARTISTS PAGE CONTENT HERE";
}


But it didn't work, anyone know where I've gone wrong?
BenSeagrave
New php-forum User
New php-forum User
 
Posts: 3
Joined: Fri Nov 04, 2011 5:20 am

Re: Multiple variables in get query string

Postby johnj » Wed Sep 05, 2012 10:59 pm

You need to use the operator for comparison and not for assignment. So, change
this
Code: Select all
$artist = "bianca"
to
Code: Select all
$artist == "bianca"
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm


Return to PHP General

Who is online

Users browsing this forum: TurnitinBot [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.