Page 1 of 1

Variable Stays the same even when url assigns new value...

Posted: Mon May 20, 2002 7:44 am
by Benjamin
I am making a webpage that will alow people to view images of models by choosing a model and an image number, however whenever anyone tries to change models, it seems to be stuck on Alexa.

Here is the code...

THIS IS THE CODE FOR INDEX.PHP
<?php
if (empty($model))
{
$model = "Select A Model";
include 'header.php';
include 'firstvisit.php';
include 'footer.php';
}
else
{
if ($model = "Alexa") $path = "alexablkdrscch";
elseif ($model = "Alexia and Tyler") $path = "alextwgrsbg";
elseif ($model = "Allisin") $path = "aliovergr";
elseif ($model = "Annie and Hanna") $path = "anihangg";
elseif ($model = "Erica") $path = "erccampjungle";
elseif ($model = "Kaylee") $path = "kaybluelng";
elseif ($model = "Monica") $path = "moniroselng";
elseif ($model = "Sydney") $path = "sydfence";
include 'header.php';
include 'photos.php';
include 'footer.php';
}
?>

THIS IS THE CODE FOR PHOTOS.PHP
<div align="center">
<?php if (empty($pic)) $pic = "001"; ?>
<img src="images/<?php echo $path . $pic . ".jpg\">"?>
</div>

THE HEADER ONLY HAS 1 LINE OF CODE
<? echo $model ?>

THE FOOTER DOESN'T HAVE ANY PHP CODE

And the FIRST VISIT.php page only contains links like the following,
index.php?model=Kaylee&pic=001

Not sure why the variable refuses to change, the code seems to be in the right order.

Posted: Mon May 20, 2002 8:29 am
by ILoveJackDaniels

Code: Select all

if ($model = "Alexa") $path = "alexablkdrscch";
You need a double equals sign in there, and for the rest of the similar lines:

Code: Select all

if ($model &#1111;b]==&#1111;/b] "Alexa") $path = "alexablkdrscch";

Thanks Lots

Posted: Mon May 20, 2002 8:46 am
by Benjamin
That would be the problem, all is well now:) I have only been coding php for about a week now, I was thinking VB when I wrote that...