|
 |
|
คือมัน บอก ว่า java scrip error อ่าครับ ใครเทพๆ ช่วย ผมทีT T |
|
 |
|
|
 |
 |
|
ลองแก้ หลายรอบแล้ว อ่าครับ T T
|
 |
 |
 |
 |
Date :
2011-12-29 23:03:05 |
By :
pee |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<SCRIPT language=JavaScript>
function add_text(x) {
document.frm.message.value = document.frm.elements.message.value+" "+ x;
document.frm.message.focus();
}
</SCRIPT>
<?
include "connect.php";
include "function.php";
$id_ques=$_GET[id_ques];
///////////////// ส่วนที่ 1 /////////////////
$sql="select * from tb_question where id_ques='$id_ques' ";
$result=mysql_db_query($dbname,$sql);
$record=mysql_fetch_array($result);
$id_ques=$record[id_ques];
$title_ques=$record[title_ques];
$detail_ques=$record[detail_ques];
$name_ques=$record[name_ques];
$email_ques=$record[email_ques];
$date_ques=$record[date_ques];
$title_ques=htmlspecialchars($title_ques);
$detail_ques=nl2br(htmlspecialchars($detail_ques));
$name_ques=htmlspecialchars($name_ques);
$email_ques=htmlspecialchars($email_ques);
$date_ques=displaydate($date_ques);
echo "
<h2>$title_ques</h2>
<table width='65%' border='1'>
<tr>
<td bgcolor='#D2E9FF'>
<font size='4' face='MS Sans Serif'><h3>
$detail_ques</h3>
<p><b>โดย :</b> $name_ques <b>อีเมล์ :</b> $email_ques <b>เมื่อ :</b> $date_ques
<a href='question_del.php?id_ques=$id_ques'> [ Delete ] </a></p></font></td>
</tr>
</table><BR>";
///////////////// ส่วนที่ 2 /////////////////
$sql="select * from tb_answer where ref_id='$id_ques' order by id_ans";
$result=mysql_db_query($dbname,$sql);
while($record=mysql_fetch_array($result)) {
$id_ans=$record[id_ans];
$detail_ans=$record[detail_ans];
$name_ans=$record[name_ans];
$email_ans=$record[email_ans];
$date_ans=$record[date_ans];
$ref_id=$record[ref_id];
$message=nl2br($record[message]);
$detail_ans=nl2br(htmlspecialchars($detail_ans));
$name_ans=htmlspecialchars($name_ans);
$email_ans=htmlspecialchars($email_ans);
$date_ans=displaydate($date_ans);
$pic="<IMG SRC='icon/smile.gif'>";
$message=str_replace(":)",$pic, $message);
echo "
<table width='65%' border='1'>
<tr>
<td bgcolor='#D2E9FF'>
<font size='2' face='MS Sans Serif'>$detail_ans <p>
<b>โดย : </b> $name_ans <b>อีเมล์ : </b> $email_ans<b> เมื่อ : </b>$date_ans
<a href='answer_del.php?&id_ques=$id_ques&id_ans=$id_ans'> [ Delete ] </a></font></td>
</tr>
</table><BR>";
} //end while
mysql_close($c);
///////////////// ส่วนที่ 3 /////////////////
?>
<h3> ร่วมตอบคำถาม </h3>
<FORM METHOD="POST" NAME="frm" ACTION="answer_save.php" ONSUBMIT="return check_data()">
<p><A HREF="javascript:add_text(':)')"><IMG SRC="icon/smile.gif" BORDER="0"></A></p>
<TABLE BGCOLOR="#D2E9FF" BORDER="0">
<TR>
<TD>รายละเอียด : </TD>
<TD><TEXTAREA NAME="frm" ROWS="5" COLS="35"></TEXTAREA> *</TD>
</TR>
<TR>
<TD>ชื่อผู้ตอบ: </TD>
<TD><INPUT TYPE="text" NAME="name_ans"> * </TD>
</TR>
<TR>
<TD>อีเมล์ :</TD>
<TD><INPUT TYPE="text" NAME="email_ans"> *</TD>
</TR>
</TABLE><BR>
<INPUT TYPE="hidden" NAME="ref_id" VALUE="<? echo $id_ques;?>">
<INPUT TYPE="submit" VALUE="Submit">
<INPUT TYPE="reset" VALUE="Reset">
</FORM>
|
 |
 |
 |
 |
Date :
2011-12-29 23:28:12 |
By :
pee |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ไล่โค้ดดูเอาเองนะครับ
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>untitled</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta name="generator" content="Geany 0.20" />
<SCRIPT language=JavaScript>
function add_text(x) {
document.frm.detail.value = document.frm.detail.value+" "+ x;
document.frm.detail.focus();
}
</SCRIPT>
</head>
<body>
<h3> ร่วมตอบคำถาม </h3>
<FORM METHOD="POST" NAME="frm" ACTION="answer_save.php" ONSUBMIT="return check_data()">
<p><A HREF="javascript:add_text(':)')">addText</A></p>
<TABLE BGCOLOR="#D2E9FF" BORDER="0">
<TR>
<TD>รายละเอียด : </TD>
<TD><TEXTAREA NAME="detail" ROWS="5" COLS="35"></TEXTAREA> *</TD>
</TR>
<TR>
<TD>ชื่อผู้ตอบ: </TD>
<TD><INPUT TYPE="text" NAME="name_ans"> * </TD>
</TR>
<TR>
<TD>อีเมล์ :</TD>
<TD><INPUT TYPE="text" NAME="email_ans"> *</TD>
</TR>
</TABLE><BR>
<INPUT TYPE="hidden" NAME="ref_id" VALUE="<? echo $id_ques;?>">
<INPUT TYPE="submit" VALUE="Submit">
<INPUT TYPE="reset" VALUE="Reset">
</FORM>
</body>
</html>
|
ประวัติการแก้ไข 2011-12-30 09:01:56
 |
 |
 |
 |
Date :
2011-12-30 09:01:22 |
By :
nautilus |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เออลืมบอกไปไม่ใช่เทพนะครับ มันเป็น javascript พื้นฐานถ้าเข้าใจการทำงานก็แก้ไขได้แล้วครับ
|
 |
 |
 |
 |
Date :
2011-12-30 09:03:18 |
By :
nautilus |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 00
|