Adding if to this code
Posted: Thu Aug 12, 2010 12:53 pm
i have tried again with my code see my previous post hereviewtopic.php?f=1&t=119814 Got in a bit of a mess, so i sat down and worked through it again and hopefully looks better.
But I want to add into here an if and an else statement so that if $_GET{"image_id_1] is not null or set from the url this line does not show "$image1 = "image_id_1=" . $_GET["image_id_1"] . "&";"
I've tried this:
but it returns a :- Parse error: syntax error, unexpected T_IF
Here is the full code
hopefully it's something simple
Cheers
Kevin
But I want to add into here an if and an else statement so that if $_GET{"image_id_1] is not null or set from the url this line does not show "$image1 = "image_id_1=" . $_GET["image_id_1"] . "&";"
I've tried this:
Code: Select all
$image1 = if ($_GET["image_id_1"]!="") echo "image_id_1=" . $_GET["image_id_1"] . "&" };
Here is the full code
Code: Select all
<?php
$returnurl = $_GET["url"] . ".php?";
$image1 = "image_id_1=" . $_GET["image_id_1"] . "&";
$image2 = "image_id_2=" . $_GET["image_id_2"] . "&";
$image3 = "image_id_3=" . $_GET["image_id_3"] . "&";
$position = $_GET['image_position'];
$newimage = "image_id" . $position ."=" .stripslashes($row['imagename']);
$prod_id = "id=" . $_GET["id"];
$position = $_GET['image_position'];
echo $returnurl . $prod_id . $image1 . $image2 . $image3 . $newimage ;
?>Cheers
Kevin