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, 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 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 or I've tried doing something like this:
Code: Select all
if(isset($_GET['artist']) {
    $artist = $_GET['artist'];
    if($artist = "bianca") {
    } elseif($artist = "bryan") {
} else {

But it didn't work, anyone know where I've gone wrong?
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
Code: Select all
$artist = "bianca"
Code: Select all
$artist == "bianca"
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: No registered users and 1 guest

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