if statement decided to stop working
Posted: Thu Feb 09, 2006 8:37 am
I've had this peice of code working nicely for a while now, but all of a sudden, it's decided not to work. I can't figure out what has changed, as i haven't changed the code. here's the code:
the site only diaplys the results from the first if statment, every time, and spits this out for every option, it seems the elseif's have stopped working.
if somebody can have a look out for something that shouldn't be there i'd be grateful:
thankyou
the site only diaplys the results from the first if statment, every time, and spits this out for every option, it seems the elseif's have stopped working.
if somebody can have a look out for something that shouldn't be there i'd be grateful:
Code: Select all
//main if statement
$productline=$row[productline];
if ($productline=="shoes" or "boots")
{
//shoes block
print ("<p class=\"shop_detail\">
<strong>Name:</strong> $row[product_make]<br />
<strong>Style:</strong> $row[style_name]<br />
</p>
<h2>Customise your shoes</h2>
<p>Pick size and colour</p>
<p><strong>Size:</strong></p>
<form action=\"http://www.fastcart.co.uk/cart/index.php\" method=\"post\">
<input type=\"hidden\" name=\"id\" value=\"9272\">
<select name=\"custom[size]\">
<option>$row[product_make] $row[style_name] - size $row[size1]</option>
</select>
<p><strong>Colour:</strong></p>
<select name=\"custom[colour]\">
<option>($row[colour1])</option>
</select><br />
<input type=\"hidden\" name=\"price\" value=\"$row[price]\"><br />
<input type=\"image\" src=\"/gfx/shop/buy_now_button.gif\" class=\"buy_button\" value=\"Add to Cart\">
</form>");
//elseif for scarves
}
elseif($productline=="scarves")
{
//scarves block
print ("<p class=\"shop_detail\">
<strong>Name:</strong> $row[product_make]<br />
<strong>Style:</strong> $row[style_name]<br />
<strong>Descripton:</strong> $row[desc_short]<br />
print ("
</p>
<a href=\"http://www.fastcart.co.uk/cart/index.php?id=9272&item=$row[product_make]+$row[style_name]&price=$row[price]\"><img class=\"buy_now\" src=\"../../gfx/shop/buy_now_button.gif\" /></a>");
//elseif for handbags
}
elseif($productline=="bags")
{
//scarves block
print ("<p class=\"shop_detail\">
<strong>Name:</strong> $row[product_make]<br />
<strong>Style:</strong> $row[style_name]<br />
<strong>Descripton:</strong> $row[desc_short]<br />
<strong>Colour:</strong> $row[colour1]<br />
<strong>Price:</strong> £$row[price]<br />
print ("
</p>
<a href=\"http://www.fastcart.co.uk/cart/index.php?id=9272&item=$row[product_make]+$row[style_name]&price=$row[price]\"><img class=\"buy_now\" src=\"../../gfx/shop/buy_now_button.gif\" /></a>");
}
elseif($productline=="hats" or "gloves")
{
//non shoes block
print ("<p class=\"shop_detail\">
<strong>Name:</strong> $row[product_make]<br />
<strong>Colour:</strong> $row[colour1]<br />
<strong>Price:</strong> £$row[price]<br />");
print ("
</p>
<a href=\"http://www.fastcart.co.uk/cart/index.php?id=9272&item=$row[product_make]+$row[style_name]&price=$row[price]\"><img class=\"buy_now\" src=\"../../gfx/shop/buy_now_button.gif\" /></a>");
}
else
{
print "error!";
}