0
我有一個購物網站。因爲當我們點擊特定產品時,它將採用該產品的ID,並將使用該ID加載另一個頁面。但是當我打開網站並單擊任何頁面不顯示的產品時。它繼續加載。當我重新加載它工作正常。它只發生在第一次。之後,當我點擊產品時,頁面會顯示。請幫幫我。在此先感謝頁面需要刷新以加載內容
。我已在頁面代碼
$id = $_GET['id'];
$_SESSION['abaya']= $id;
上面的代碼是從哪裏獲得的ID。我已附加下面的特定頁面
<!DOCTYPE html>
<html lang="en"><head>
<meta charset="utf-8">
<title>Abayat Dubai</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
</head>
<body>
<section id="portfolio" class="portfolio">
<div class="container">
<div class="row">
<div class="span6" style="float:left">
<?php
$code="{$_SESSION['abaya']}";
?>
<!--begin span4 -->
<div class="view view-first" id="frockone">
<img src="images/photos/<?php echo"$code";?>.jpg" alt="frock">
</div>
</div>
<div class="span5" style="float: right; padding-left:5%">
<?php
$query="SELECT * FROM s_product WHERE code='$code';";
$result=mysql_query($query)
or die("could not perform query");
$name="{$_SESSION['country']}";
$price="error";
while($row=mysql_fetch_array($result,MYSQL_ASSOC))
{
$p_name="{$row['img_name']}";
?>
<h4><?php echo"{$row['img_name']}";?></h4>
<p>Description : <?php echo"{$row['description']}";?> </p>
<?php if($name=="sri"){
$currency="LKR ";
$price="{$row['sri_price']}";
}
elseif($name=="uae"){
$currency="AED ";
$price="{$row['price']}";
}
elseif($name=="australia"){
$currency="AUD ";
$price="{$row['australia_price']}";
}
else{
$currency="USD ";
$price="{$row['usa_price']}";
}?>
<h6 style="color:#a62b6d; font-size:18px"> <span><?php echo"$currency","$price"?></span></h6>
<?php
$price_us="{$row['usa_price']}";
break;
}?>
<hr>
<div>
<form name="product" method="post" action="pro.php">
<select name="quantity" style="width:100px; padding:2%">
<option selected="selected" value="">Quantity</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select><br />
<select name="size" style="width:100px; padding:2%">
<option selected="selected" value="">Size</option>
<option value="50">50</option>
<option value="52">52</option>
<option value="54">54</option>
<option value="56">56</option>
<option value="58">58</option>
</select>
<br /><br />
<input type="submit" class="btn btn-small btn-primary btn-embossed but" value="Add To Bag" onclick="return validate()" name="add_cart" style="margin-right:5%"/>
<a href="sale_home.php"> Continue shopping!</a>
<br />
</form>
<?php
if(isset($_SESSION['user_tempid']))
{?>
<?php }else{
date_default_timezone_set('Asia/Dubai');
$today = date("Y-m-d H:i:s");
$_SESSION['user_tempid']="$today";
$i=1;
$query8="select * from temp_id;";
$result8=mysql_query($query8) or die("can not login");
while($row=mysql_fetch_array($result8,MYSQL_ASSOC)){
if($row['id']=="$today"){
$_SESSION['user_tempid']="$today$i";
$i++;
}
}
}
?>
<?php
if(isset($_POST["add_cart"]))
{
$quantity=$_POST["quantity"];
$size=$_POST["size"];
$cost=$quantity*$price;
$usd=$quantity*$price_us;
$query="INSERT INTO temp_cartitem(user_id,product_id,size,quantity,ori_price,cost,product_name,currency,usd) VALUES('{$_SESSION['user_tempid']}','$code','$size','$quantity','$price','$cost','$p_name','$currency','$usd')";
$result= mysql_query($query) or die("failed to insert your record");
//header('location:cart.php');
}
?>
</div>
<hr>
</div>
</div>
<br /><br /><br />
<!--end small list-->
</div>
</section>
</div>
</body>
</html>
第一次訪問時檢查日誌。 – Jigar
您的意思是檢查元素 –
我的網站是「abayatdubai.com」。 –