 |
ช่วยดูโค้ดทีค่ะ พอเพิ่มความคิดเห็นเสร็จแล้ว มันไม่กลับมาหน้าเดิม |
|
 |
|
|
 |
 |
|
ยกตัวอย่างเช่น
- พอเพิ่มข้อมูลหน้า product_detail.php?product_id='1' แล้วมันไม่กลับมาหน้าเดิมค่ะ
มันเด้งไปหน้า index แทน อยากให้กลับมาหน้า product_detail.php?product_id='1' อ่ะค่ะ
- ข้อมูลทุกอย่างเพิ่มลงฐานข้อมูลนะคะ แต่ ไม่ alert (เพิ่มความคิดเห็นของคุณเรียบร้อยแล้ว)
ด้วยอ่ะค่ะ
Code (PHP)
<?php
$resultPro=select("product","where 1 and product_id='".$_GET["product_id"]."'" );
if(!$resultPro)
{
header("location:index.php");
}
if($_GET["action"]=="Add")
{
$sql = "insert into product_comment (name,email,message,date,time,email_status,product_id) Values ('$_POST[name]','$_POST[email]','$_POST[message]','$_POST[date]','$_POST[time]','$_POST[email_status]'
,'$_POST[product_id]')";
$dbquery = mysql_query($sql);
echo "<script language=\"JavaScript\">";
echo "alert('เพิ่มความคิดเห็นของคุณเรียบร้อยแล้ว');";
echo"window.location='product_detail.php?product_id=".$_POST[product_id]."';";
echo "</script>";
}
$nowdate = date("Y-m-d");
$nowtime = date("H:i");
?>
<form id="frmComment" name="frmComment" method="post" action="?action=Add" onsubmit="">
<table width="400" border="0" cellspacing="3" cellpadding="3" class="wh1_tb" >
<tr colspan="2" align="left">
<td >
ชื่อผู้แสดงความคิดเห็น
</td>
<td >
อีเมล์ <a href="editprofile.php"><img src="images/buttons/reply.png" title="คลิกที่นี่เพื่อแก้ไขอีเมล์" border="0" /></a>
</td>
</tr>
<tr colspan="2" align="left">
<td >
<input name="name" type="text" id="name" size="35" maxlength="50" title="ชื่อ" value="<?=$_SESSION["strUname"];?>" readonly="readonly" style="height:25px; border: 1px solid #CCCCCC; background-color:#EAEAEA"/>
</td>
<td >
<input name="email" type="text" id="email" size="35" maxlength="60" title="อีเมล์" value="<?=$resultUser["m_email"];?>" readonly="readonly" style="height:25px; border: 1px solid #CCCCCC; background-color:#EAEAEA" />
</td>
</tr>
<tr>
<td>
</td>
</tr>
<tr>
<td colspan="2">
<textarea id="message" name="message" cols="50" rows="5" ></textarea>
</td>
</tr>
<tr colspan="2">
<td align="left"> อนุญาติให้แสดงอีเมล์ <input type="radio" name="email_status" id="email_status" value="1" checked="checked"/>ใช่
<input type="radio" name="email_status" id="email_status" value="0" /> ไม่ใช่
<input name="date" type="hidden" id="date" value="<?=$nowdate?>">
<input name="time" type="hidden" id="time" value="<?=$nowtime?>">
<input name="product_id" type="hidden" id="product_id" value="<?=$_GET[product_id];?>">
</td>
<td align="right" >
<input type="submit" name="button" id="button" value="แสดงความคิดเห็น" />
</td>
</tr>
</table>
</form>
Tag : PHP, HTML/CSS
|
ประวัติการแก้ไข 2012-05-15 10:27:20 2012-05-15 10:28:20 2012-05-15 10:30:01 2012-05-15 10:30:30 2012-05-15 10:31:22
|
 |
 |
 |
 |
Date :
2012-05-15 10:26:53 |
By :
Witchloves |
View :
1508 |
Reply :
9 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
echo alert("เพิ่มความคิดเห็นของคุณเรียบร้อยแล้ว");
ผมว่ามันน่าจะเป็นอย่างนี้มากกว่านะครับ
ลองดูครับ
|
ประวัติการแก้ไข 2012-05-15 10:40:24
 |
 |
 |
 |
Date :
2012-05-15 10:40:01 |
By :
MaTaDoRcpe |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ไม่ได้เหมือนเดิมอ่าค่ะ
แต่ยังไงก็ขอบคุณนะคะ ^^
|
 |
 |
 |
 |
Date :
2012-05-15 11:32:06 |
By :
Witchloves |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ก็น่าจะถูกแล้วน่ะครับ
|
 |
 |
 |
 |
Date :
2012-05-15 11:46:53 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เหมือนจะเคยทำได้แล้วนะคะ แต่ว่า..พอตรวจสอบเว็บ แล้วมันไม่ได้ขึ้นมาเฉยๆ เลย =_="
|
 |
 |
 |
 |
Date :
2012-05-15 11:49:17 |
By :
Witchloves |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ทำได้แล้วค่ะ ^^ มันติดเงื่อนไข
if(!$resultPro)
{
header("location:index.php");
}
พอเพิ่มแล้ว ค่า id มันไม่ส่งมา เลยดักค่า
if(!$resultPro)
{
...
}
ที่เนื้อหาแทน
ปล.ขอบคุณนะคะ พี่วิน อิอิ..
|
 |
 |
 |
 |
Date :
2012-05-15 12:19:34 |
By :
Witchloves |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|

|
 |
 |
 |
 |
Date :
2012-05-15 12:40:33 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
percent of the answers right counted as passing, and you're going to need to know know <i><b><a href=http://www.newjordansmall.com>jordan spizike 2012</a></b></i> know more than that about credit scores in order to have a tip-top one!
were some troubling misconceptions people had about credit scores that are worth discussing.For example, 10 10 <b><a href=http://www.newdownjacketsshop.com/>canada goose jackets for sale</a></b> 10 percent of participants believed that student loans are not counted toward credit scores.
That's a problem, especially since a report earlier this year from the Federal Reserve Reserve <i><b><a href=http://www.newdownjacketsshop.com>canada goose parka for men</a></b></i> Reserve Bank of New York showed that Americans now have more student loan debt than
|
 |
 |
 |
 |
Date :
2012-12-01 12:41:05 |
By :
goowholesale |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
header("location:product_detail.php?product_id='1' ");
อย่างงี้ถูกที่สุดค่ะ
|
 |
 |
 |
 |
Date :
2012-12-01 15:20:16 |
By :
บิ้ง |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|