Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,028

HOME > PHP > PHP Forum > เรื่องการตรวจสอบค่าว่าง ก่อนทำการ insert คือผมใช้รูปภาพแทนปุ่ม submit แต่มันไม่ยอมเข้า function



 

เรื่องการตรวจสอบค่าว่าง ก่อนทำการ insert คือผมใช้รูปภาพแทนปุ่ม submit แต่มันไม่ยอมเข้า function

 



Topic : 032761



โพสกระทู้ ( 613 )
บทความ ( 0 )



สถานะออฟไลน์




คือผมใช้รูปภาพแทนปุ่ม submit แต่มันไม่ยอมเข้า function แต่ถ้าใช้ปุ่ม submit มันก็เข้า function ช่วยดูให้ผมหน่อย

Code (PHP)
<script language="javascript">
function fncSubmit()
{
	if(document.frm1.txttit.value == "")
	{
		alert('!!! กรุณาใส่ชื่อเรื่องการประชุม');
		document.frm1.txttit.focus();
		return false;
	}	
	if(document.frm1.roomddl.value <1)
	{
		alert('!!! กรุณาเลือกห้องประชุม');
		document.frm1.roomddl.focus();		
		return false;
	}	
	if(document.frm1.txtdate.value == "")
	{
		alert('!!! กรุณาใส่วันที่ต้องการจอง');
		document.frm1.txtdate.focus();
		return false;
	}
	if(document.frm1.timedll.value <1)
	{
		alert('!!! กรุณาเืลือกเวลาที่ต้องการจอง');
		document.frm1.timedll.focus();
		return false;
	}
	if(document.frm1.namerestxt.value == "")
	{
		alert('!!! กรุณาใส่ชื่อผู้จอง');
		document.frm1.namerestxt.focus();
		return false;
	}
	if(document.frm1.txttell.value == "")
	{
		alert('!!! กรุณาใส่เบอร์ติดต่อ');
		document.frm1.txttell.focus();
		return false;
	}
	document.form1.submit();
}
</script>

<FORM name="frm1" METHOD=POST ACTION="insert_admin.php" onSubmit="JavaScript:return fncSubmit();">
              <tr>
                <td height="20">&nbsp;</td>
                <td height="20" align="right" valign="top">เรื่องการประชุม :&nbsp;</td>
                <td height="20" align="left" valign="middle">&nbsp;
                  <textarea name="txttit"></textarea></td>
                <td height="20">&nbsp;</td>
              </tr>
                    <tr>
                      <td height="25">&nbsp;</td>
                      <td height="25"><div align="right">ห้องประชุม :&nbsp;</div></td>
                      <td height="25"><div align="left">&nbsp;
                              <select name="roomddl" size="1" id="roomddl">
                                <option>-- เลือกห้องประชุม --</option>
                                <option value="1">ห้องประชุม 1</option>
                                <option value="2">ห้องประชุม 2</option>
                              </select>
                      </div></td>
                      <td height="25">&nbsp;</td>
                    </tr>
                    <tr>
                      <td width="71" height="25">&nbsp;</td>
                      <td width="237" height="25"><div align="right">วันที่ต้องการจอง :&nbsp;</div></td>
                      <td width="257" height="25"><div align="left">&nbsp;
                              <input name="txtdate" id="popup_container" type="date" size="10"/>
                              <input type="hidden" name="id" value="<?=$id?>" />
                      </div></td>
                      <td width="65" height="25">&nbsp;</td>
                    </tr>
                    <tr>
                      <td height="25">&nbsp;</td>
                      <td height="25"><div align="right">ช่วงเวลา :&nbsp;</div></td>
                      <td height="25"><div align="left">&nbsp;
                              <select name="timedll" id="timedll">
                                <option>--เลือกช่วงเวลา --</option>
                                <option value="1">เช้า</option>
                                <option value="2">บ่าย</option>
                                <option value="3">เช้า - บ่าย</option>
                              </select>
                      </div></td>
                      <td height="25">&nbsp;</td>
                    </tr>
                    <tr>
                      <td height="25">&nbsp;</td>
                      <td height="25"><div align="right">ชื่อผู้จอง :&nbsp;</div></td>
                      <td height="25"><div align="left">&nbsp;
                              <input name="namerestxt" type="text" size="25" />
                      </div></td>
                      <td height="25">&nbsp;</td>
                    </tr>
                    <tr>
                      <td height="25">&nbsp;</td>
                      <td height="25"><div align="right">หน่วยงาน :&nbsp;</div></td>
                      <td height="25"><div align="left">&nbsp;
                          <input name="nameunit" type="text" value="<?echo $_SESSION['name_units'];?>" size="16" readonly="readonly" />
                        <input name="txtunit" type="hidden" value="<?echo $_SESSION['units'];?>" size="18" readonly="readonly" />
                      </div></td>
                      <td height="25">&nbsp;</td>
                    </tr>
					<tr>
                <td height="25">&nbsp;</td>
                <td height="25"><div align="right">เบอร์ติดต่อ :&nbsp;</div></td>
                <td height="25" align="left" valign="top">&nbsp;
                  <INPUT NAME="txttell" TYPE="text" size="10" maxlength="10"></td>
                <td height="25">&nbsp;</td>
              </tr>
                    <tr>
                      <td height="105">&nbsp;</td>
                      <td height="105">&nbsp;</td>
                      <td height="105" align="right" valign="top"><INPUT TYPE="submit">
				  <a href="javascript:document.frm1.submit()"><img src="pic/submit1.gif" alt="กดเพื่อจองห้องประชุม" width="73" height="54" border="0" align="top" /></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
                      <td height="105">&nbsp;</td>
                    </tr>
                  </form>




Tag : - - - -







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2009-10-08 09:49:27 By : oasiis View : 1715 Reply : 30
 

 

No. 1



โพสกระทู้ ( 326 )
บทความ ( 0 )



สถานะออฟไลน์


"><INPUT TYPE="submit">
114.
<a href="javascript:document.frm1.submit()">
type submit เปลี่ยนเป็น button แล้ว ใส่รุปเป็นbg แทน ด้วยcssครับ มันจะใช้ได้ตามปกติ






Date : 2009-10-08 09:53:04 By : apicha31
 


 

No. 2



โพสกระทู้ ( 942 )
บทความ ( 0 )



สถานะออฟไลน์


<a href="javascript:document.frm1.submit()"><img src="pic/submit1.gif" alt="กดเพื่อจองห้องประชุม" width="73" height="54" border="0" align="top" /></a>

ไม่จำเป็นต้องมีแท็ก <a....> ก็ได้ครับ

ใช้ <img ...... > พอครับ

เพิ่มอีเว้นต์ onclick="funcSubmit" เข้าไปครับ

ดูท่าทางฟังค์ชั่นของคุณทำงานไม่สมบูรณ์เท่าไหร่นะครับ
Date : 2009-10-08 09:54:27 By : NanoThoro
 

 

No. 3



โพสกระทู้ ( 613 )
บทความ ( 0 )



สถานะออฟไลน์


ยังไม่ได้ครับ งง
Date : 2009-10-08 10:09:46 By : oasiis
 


 

No. 4



โพสกระทู้ ( 2,794 )
บทความ ( 0 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์


Code (PHP)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<title>Untitled Document</title>
</head>
<script language="javascript">
function fncSubmit()
{
	if(document.frm1.txttit.value == "")
	{
		alert('!!! กรุณาใส่ชื่อเรื่องการประชุม');
		document.frm1.txttit.focus();
		return false;
	}	
	if(document.frm1.roomddl.value <1)
	{
		alert('!!! กรุณาเลือกห้องประชุม');
		document.frm1.roomddl.focus();		
		return false;
	}	
	if(document.frm1.txtdate.value == "")
	{
		alert('!!! กรุณาใส่วันที่ต้องการจอง');
		document.frm1.txtdate.focus();
		return false;
	}
	if(document.frm1.timedll.value <1)
	{
		alert('!!! กรุณาเืลือกเวลาที่ต้องการจอง');
		document.frm1.timedll.focus();
		return false;
	}
	if(document.frm1.namerestxt.value == "")
	{
		alert('!!! กรุณาใส่ชื่อผู้จอง');
		document.frm1.namerestxt.focus();
		return false;
	}
	if(document.frm1.txttell.value == "")
	{
		alert('!!! กรุณาใส่เบอร์ติดต่อ');
		document.frm1.txttell.focus();
		return false;
	}
	document.form1.submit();
}
</script>

<body>
<FORM name="frm1" METHOD=POST ACTION="insert_admin.php" onSubmit="JavaScript:return fncSubmit();">
              <tr>
                <td height="20">&nbsp;</td>
                <td height="20" align="right" valign="top">เรื่องการประชุม :&nbsp;</td>
                <td height="20" align="left" valign="middle">&nbsp;
                  <textarea name="txttit"></textarea></td>
                <td height="20">&nbsp;</td>
              </tr>
                    <tr>
                      <td height="25">&nbsp;</td>
                      <td height="25"><div align="right">ห้องประชุม :&nbsp;</div></td>
                      <td height="25"><div align="left">&nbsp;
                              <select name="roomddl" size="1" id="roomddl">
                                <option>-- เลือกห้องประชุม --</option>
                                <option value="1">ห้องประชุม 1</option>
                                <option value="2">ห้องประชุม 2</option>
                              </select>
                      </div></td>
                      <td height="25">&nbsp;</td>
                    </tr>
                    <tr>
                      <td width="71" height="25">&nbsp;</td>
                      <td width="237" height="25"><div align="right">วันที่ต้องการจอง :&nbsp;</div></td>
                      <td width="257" height="25"><div align="left">&nbsp;
                              <input name="txtdate" id="popup_container" type="date" size="10"/>
                              <input type="hidden" name="id" value="<?=$id?>" />
                      </div></td>
                      <td width="65" height="25">&nbsp;</td>
                    </tr>
                    <tr>
                      <td height="25">&nbsp;</td>
                      <td height="25"><div align="right">ช่วงเวลา :&nbsp;</div></td>
                      <td height="25"><div align="left">&nbsp;
                              <select name="timedll" id="timedll">
                                <option>--เลือกช่วงเวลา --</option>
                                <option value="1">เช้า</option>
                                <option value="2">บ่าย</option>
                                <option value="3">เช้า - บ่าย</option>
                              </select>
                      </div></td>
                      <td height="25">&nbsp;</td>
                    </tr>
                    <tr>
                      <td height="25">&nbsp;</td>
                      <td height="25"><div align="right">ชื่อผู้จอง :&nbsp;</div></td>
                      <td height="25"><div align="left">&nbsp;
                              <input name="namerestxt" type="text" size="25" />
                      </div></td>
                      <td height="25">&nbsp;</td>
                    </tr>
                    <tr>
                      <td height="25">&nbsp;</td>
                      <td height="25"><div align="right">หน่วยงาน :&nbsp;</div></td>
                      <td height="25"><div align="left">&nbsp;
                          <input name="nameunit" type="text" value="<?echo $_SESSION['name_units'];?>" size="16" readonly="readonly" />
                        <input name="txtunit" type="hidden" value="<?echo $_SESSION['units'];?>" size="18" readonly="readonly" />
                      </div></td>
                      <td height="25">&nbsp;</td>
                    </tr>
					<tr>
                <td height="25">&nbsp;</td>
                <td height="25"><div align="right">เบอร์ติดต่อ :&nbsp;</div></td>
                <td height="25" align="left" valign="top">&nbsp;
                  <INPUT NAME="txttell" TYPE="text" size="10" maxlength="10"></td>
                <td height="25">&nbsp;</td>
              </tr>
                    <tr>
                      <td height="105">&nbsp;</td>
                      <td height="105">&nbsp;</td>
                      <td height="105" align="right" valign="top"><INPUT TYPE="submit">
				  <img src="pic/submit1.gif" alt="กดเพื่อจองห้องประชุม" width="73" height="54" border="0" align="top" onclick="JavaScript:return fncSubmit();" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
                      <td height="105">&nbsp;</td>
                    </tr>
                  </form>
</body>
</html>


Date : 2009-10-08 10:16:08 By : panyapol
 


 

No. 5



โพสกระทู้ ( 942 )
บทความ ( 0 )



สถานะออฟไลน์


เอาไปลองดู แทนที่ตัวเดิม หรือสร้างไฟล์ใหม่เพื่อทดลองครับ
<html>
<head>
<script language="javascript">
function SubmitForm()
{
	if(document.frm1.txttit.value == "")
	{
		alert('!!! กรุณาใส่ชื่อเรื่องการประชุม');
		document.frm1.txttit.focus();
		return false;
	}	else
	if(document.frm1.roomddl.value <1)
	{
		alert('!!! กรุณาเลือกห้องประชุม');
		document.frm1.roomddl.focus();		
		return false;
	}	else
	if(document.frm1.txtdate.value == "")
	{
		alert('!!! กรุณาใส่วันที่ต้องการจอง');
		document.frm1.txtdate.focus();
		return false;
	} else
	if(document.frm1.timedll.value <1)
	{
		alert('!!! กรุณาเืลือกเวลาที่ต้องการจอง');
		document.frm1.timedll.focus();
		return false;
	} else
	if(document.frm1.namerestxt.value == "")
	{
		alert('!!! กรุณาใส่ชื่อผู้จอง');
		document.frm1.namerestxt.focus();
		return false;
	} else
	if(document.frm1.txttell.value == "")
	{
		alert('!!! กรุณาใส่เบอร์ติดต่อ');
		document.frm1.txttell.focus();
		return false;
	} else
	document.form1.submit();
}
</script>
</head>
<body>

<FORM name="frm1" METHOD=POST ACTION="insert_admin.php">
              <tr>
                <td height="20">&nbsp;</td>
                <td height="20" align="right" valign="top">เรื่องการประชุม :&nbsp;</td>
                <td height="20" align="left" valign="middle">&nbsp;
                  <textarea name="txttit"></textarea></td>
                <td height="20">&nbsp;</td>
              </tr>
                    <tr>
                      <td height="25">&nbsp;</td>
                      <td height="25"><div align="right">ห้องประชุม :&nbsp;</div></td>
                      <td height="25"><div align="left">&nbsp;
                              <select name="roomddl" size="1" id="roomddl">
                                <option>-- เลือกห้องประชุม --</option>
                                <option value="1">ห้องประชุม 1</option>
                                <option value="2">ห้องประชุม 2</option>
                              </select>
                      </div></td>
                      <td height="25">&nbsp;</td>
                    </tr>
                    <tr>
                      <td width="71" height="25">&nbsp;</td>
                      <td width="237" height="25"><div align="right">วันที่ต้องการจอง :&nbsp;</div></td>
                      <td width="257" height="25"><div align="left">&nbsp;
                              <input name="txtdate" id="popup_container" type="date" size="10"/>
                              <input type="hidden" name="id" value="<?=$id?>" />
                      </div></td>
                      <td width="65" height="25">&nbsp;</td>
                    </tr>
                    <tr>
                      <td height="25">&nbsp;</td>
                      <td height="25"><div align="right">ช่วงเวลา :&nbsp;</div></td>
                      <td height="25"><div align="left">&nbsp;
                              <select name="timedll" id="timedll">
                                <option>--เลือกช่วงเวลา --</option>
                                <option value="1">เช้า</option>
                                <option value="2">บ่าย</option>
                                <option value="3">เช้า - บ่าย</option>
                              </select>
                      </div></td>
                      <td height="25">&nbsp;</td>
                    </tr>
                    <tr>
                      <td height="25">&nbsp;</td>
                      <td height="25"><div align="right">ชื่อผู้จอง :&nbsp;</div></td>
                      <td height="25"><div align="left">&nbsp;
                              <input name="namerestxt" type="text" size="25" />
                      </div></td>
                      <td height="25">&nbsp;</td>
                    </tr>
                    <tr>
                      <td height="25">&nbsp;</td>
                      <td height="25"><div align="right">หน่วยงาน :&nbsp;</div></td>
                      <td height="25"><div align="left">&nbsp;
                          <input name="nameunit" type="text" value="<?echo $_SESSION['name_units'];?>" size="16" readonly="readonly" />
                        <input name="txtunit" type="hidden" value="<?echo $_SESSION['units'];?>" size="18" readonly="readonly" />
                      </div></td>
                      <td height="25">&nbsp;</td>
                    </tr>
					<tr>
                <td height="25">&nbsp;</td>
                <td height="25"><div align="right">เบอร์ติดต่อ :&nbsp;</div></td>
                <td height="25" align="left" valign="top">&nbsp;
                  <INPUT NAME="txttell" TYPE="text" size="10" maxlength="10"></td>
                <td height="25">&nbsp;</td>
              </tr>
                    <tr>
                      <td height="105">&nbsp;</td>
                      <td height="105">&nbsp;</td>
                      <td height="105" align="right" valign="top"><INPUT TYPE="submit">
				  <img src="pic/submit1.gif" alt="กดเพื่อจองห้องประชุม" width="73" height="54" border="0" align="top" onclick="return SubmitForm()"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
                      <td height="105">&nbsp;</td>
                    </tr>
                  </form>
                  
</body>
</html>                  



Date : 2009-10-08 10:17:20 By : NanoThoro
 


 

No. 6



โพสกระทู้ ( 613 )
บทความ ( 0 )



สถานะออฟไลน์


ไม่ได้ ครับ เข้า function แต่ไม่ส่งข้อมูลครับ
Date : 2009-10-08 10:22:58 By : oasiis
 


 

No. 7



โพสกระทู้ ( 942 )
บทความ ( 0 )



สถานะออฟไลน์


ของเพ่พี หรือของเพ่นาโนครับ
Date : 2009-10-08 10:24:05 By : NanoThoro
 


 

No. 8



โพสกระทู้ ( 2,794 )
บทความ ( 0 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์


อ่ะนะ ... ถ้ายังไม่ได้อีกก็จนปัญญาล่ะ
Date : 2009-10-08 10:26:11 By : panyapol
 


 

No. 9



โพสกระทู้ ( 942 )
บทความ ( 0 )



สถานะออฟไลน์


document.form1.submit();

บันทัดนี้ผิดนี่นา

document.frm1.submit();
Date : 2009-10-08 10:28:02 By : NanoThoro
 


 

No. 10



โพสกระทู้ ( 942 )
บทความ ( 0 )



สถานะออฟไลน์


โถเพ่พี ช่วยกันหน่อย เดี๋ยน้องเขาเลี้ยงข้าว อิอิอิ
Date : 2009-10-08 10:28:41 By : NanoThoro
 


 

No. 11



โพสกระทู้ ( 613 )
บทความ ( 0 )



สถานะออฟไลน์


ของ พี่นาโน ไม่เข้า function ครับ
onclick="return fncSubmit();"

ของพี่แพร เข้า function แต่ insert
onclick="JavaScript:return fncSubmit();"
Date : 2009-10-08 10:29:52 By : oasiis
 


 

No. 12



โพสกระทู้ ( 613 )
บทความ ( 0 )



สถานะออฟไลน์


Quote:
document.form1.submit();

บันทัดนี้ผิดนี่นา

document.frm1.submit();

ได้แล้วครับ

แต่ทำไมมันไม่แสดงรูปมืออ่ะครับ
Date : 2009-10-08 10:32:51 By : oasiis
 


 

No. 13



โพสกระทู้ ( 942 )
บทความ ( 0 )



สถานะออฟไลน์


ของเพ่ SubmitForm ต่างหากน้อง หรือว่าน้องเปลี่ยนไปแล้ว
Date : 2009-10-08 10:36:23 By : NanoThoro
 


 

No. 14



โพสกระทู้ ( 942 )
บทความ ( 0 )



สถานะออฟไลน์


ในคำสั่งนี้เข้าไปในแท็กอิมเมจ

style="cursor:hand"
Date : 2009-10-08 10:37:24 By : NanoThoro
 


 

No. 15



โพสกระทู้ ( 2,794 )
บทความ ( 0 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์


Quote:
แต่ทำไมมันไม่แสดงรูปมืออ่ะครับ

ลองดูที่ Path รูป
Date : 2009-10-08 10:40:46 By : panyapol
 


 

No. 16



โพสกระทู้ ( 613 )
บทความ ( 0 )



สถานะออฟไลน์


ผมอยากถามอีกหน่อยครับ
java script ที่เกี่ยวกับวันที่ปัจจุบัน เขียนยังไงครับ คือผมต้องการเช็คเรื่องของเวลา ไม่ให้จองย้อนหลังได้ครับ

แบบนี้ครับ

Code (PHP)
$d=date('Y-m-d');
if ($uu<=$d){
	echo "<script>alert(' !!! คุณไม่สามารถจองห้องย้อนหลังได้ !!! ');window.location='index_admin.php';</script>";exit();
}


แต่อยากให้เป็น js อ่ะครับ
Date : 2009-10-08 10:42:29 By : oasiis
 


 

No. 17



โพสกระทู้ ( 942 )
บทความ ( 0 )



สถานะออฟไลน์


var d = new Date();
var nTime = d.toTimeString();
var nDate = d.toYMDString();

ทำไมไม่ใช้พีเอชพีส่งค่าเข้า จาว่าสคริปละครับ
Date : 2009-10-08 10:51:21 By : NanoThoro
 


 

No. 18



โพสกระทู้ ( 613 )
บทความ ( 0 )



สถานะออฟไลน์


ยังไงอ่ะครับ
Date : 2009-10-08 10:53:32 By : oasiis
 


 

No. 19



โพสกระทู้ ( 2,794 )
บทความ ( 0 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์


ไม่ให้เลือกวันที่ย้อนหลังได้
Code (PHP)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<link rel="stylesheet" type="text/css" href="css/smoothness/jquery-ui-1.7.2.custom.css">  
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>  
<script type="text/javascript" src="js/jquery-ui-1.7.2.custom.min.js"></script>  
<script type="text/javascript">  
$(function(){  
    // แทรกโค้ต jquery  
    $("#dateInput").datepicker({minDate: 0});  
    // minDate: -20 ไม่สามารถเลือกวันที่ ก่อน 20 วันก่อนหน้าได้  
    // maxDate: '+1M +10D' ไม่สามารถเลือก วันที่ถัดจาก อีก 1 เดือนและ 10 วัน ได้  
    // หากต้องการให้เลือกวันที่ได้เฉพาะวันปัจจุบันเป็นต้นไป  
    // สามารถกำหนด เป็น $("#dateInput").datepicker({minDate: 0});  
});  
</script> 

<!--CSS code กำหนดความกว้าง และขนาดตัวอักษรของ ปฏิทิน -->
<style type="text/css">  
.ui-datepicker{  
    width:150px;  
    font-family:tahoma;  
    font-size:11px;  
    text-align:center;  
}  
</style> 
<body>
<input type="text" name="dateInput" id="dateInput" /> 
</body>
</html>



Ref : http://docs.jquery.com/UI/Datepicker
Date : 2009-10-08 10:54:12 By : panyapol
 


 

No. 20



โพสกระทู้ ( 942 )
บทความ ( 0 )



สถานะออฟไลน์


ได้หรือยังน้องชาย
Date : 2009-10-08 10:59:24 By : NanoThoro
 


 

No. 21



โพสกระทู้ ( 613 )
บทความ ( 0 )



สถานะออฟไลน์


ยังเลยครับ
Date : 2009-10-08 11:01:24 By : oasiis
 


 

No. 22



โพสกระทู้ ( 942 )
บทความ ( 0 )



สถานะออฟไลน์


ติดปัญหาตรงไหน โค้ดมาดูหน่อยครับ
Date : 2009-10-08 11:06:24 By : NanoThoro
 


 

No. 23



โพสกระทู้ ( 613 )
บทความ ( 0 )



สถานะออฟไลน์


ของพี่แพร มันลิ้งค์ไปไหนครับ link rel
Date : 2009-10-08 11:07:22 By : oasiis
 


 

No. 24



โพสกระทู้ ( 613 )
บทความ ( 0 )



สถานะออฟไลน์


Code (PHP)
<?
session_start();
include "check.php";
include "check_level.php";
include "conn.php";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />

<title>ระบบจองห้องประชุม สำนักงานจังหวัดลำปาง</title>
<link rel="stylesheet" type="text/css" href="epoch_styles.css" />
<script type="text/javascript" src="epoch_classes.js"></script>
<script type="text/javascript">
	var bas_cal,dp_cal,ms_cal;      
window.onload = function () {
	dp_cal  = new Epoch('epoch_popup','popup',document.getElementById('popup_container'));
};
</script>

<script language="javascript" type="text/javascript">
function LogoutSystem() //ประยุกใช้เอาตามสถานการณ์นะครับ
{
parent.location.replace("logout.php"); //คำสั่งที่ให้ไปยังเพจอื่นเมื่อถึงเวลาที่กำหนด ใช้แพแรนท์ตามด้วยชื่อเฟรม หากไม่มีเฟรมก็ตัดทิ้งไป แล้วทามด้วยโลเคชั่น ตามด้วยรีเพลค สาเหตุที่ใช้รีเพลคเพราะไม่ต้องการให้สามารถกดปุ่มย้อนกลับได้
}

var timer1;
function Ehandler()
{
clearTimeout(timer1);
timer1 = setTimeout("LogoutSystem()", 1000*60*10);
return true;
}

Ehandler();

if(!document.all){window.captureEvents(Event.CLICK | Event.KEYPRESS);}
window.onclick = Ehandler;
window.onkeypress = Ehandler;
</script>

<style type="text/css">
<!--
body,td,th {
	font-family: MS Reference Sans Serif;
}
a {
	font-family: MS Reference Sans Serif;
}
h1,h2,h3,h4,h5,h6 {
	font-family: MS Reference Sans Serif;
}
.style1 {color: #990000}
.style2 {
	color: #CC3300;
	font-size: 14px;
}
.style3 {font-size: 14px}
-->
</style></head>
<body onclick="Ehandler()" onkeypress="Ehandler()">

<script language="javascript">
var d = new Date();
var nTime = d.toTimeString();
var nDate = d.toYMDString();

function fncSubmit()
{
	if(document.frm1.txttit.value == "")
	{
		alert('!!! กรุณาใส่ชื่อเรื่องการประชุม');
		document.frm1.txttit.focus();
		return false;
	}	
	if(document.frm1.roomddl.value <1)
	{
		alert('!!! กรุณาเลือกห้องประชุม');
		document.frm1.roomddl.focus();		
		return false;
	}	
	if(document.frm1.txtdate.value == "")
	{
		alert('!!! กรุณาใส่วันที่ต้องการจอง');
		document.frm1.txtdate.focus();
		return false;
	}
	if(document.frm1.txtdate.value < nDate)
	{
		alert('!!! คุณกำลังจองวันที่ย้องหลัง');
		document.frm1.txtdate.focus();
		return false;
	}
	if(document.frm1.timedll.value <1)
	{
		alert('!!! กรุณาเืลือกเวลาที่ต้องการจอง');
		document.frm1.timedll.focus();
		return false;
	}
	if(document.frm1.namerestxt.value == "")
	{
		alert('!!! กรุณาใส่ชื่อผู้จอง');
		document.frm1.namerestxt.focus();
		return false;
	}
	if(document.frm1.txttell.value == "")
	{
		alert('!!! กรุณาใส่เบอร์ติดต่อ');
		document.frm1.txttell.focus();
		return false;
	}
	document.frm1.submit();
}
</script>


<table width="650" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><div align="center">
      <table width="650" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td><img src="pic/head_admin.gif" width="730" height="103" /></td>
        </tr>
        <tr>
          <td valign="middle"><table width="730" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td width="215" align="left" valign="middle"><span class="style1"><span class="style3"><img src="pic/2.gif" width="20" height="29" border="0" align="absmiddle" />
                    <?
		      echo $_SESSION['name_level'];?>
              </span> :&nbsp;<span class="style2"><?echo $_SESSION['name_units'];?></span></span></td>
               <td width="515" height="33" align="right" valign="middle"><a href="index_admin.php"><img src="pic/home.gif" alt="กลับสู่หน้าหลัก" width="88" height="30" border="0" align="absmiddle" /></a>&nbsp;<a href="list_admin.php"><img src="pic/list.gif" alt="ตารางข้อมูลการจอก" width="123" height="30" border="0" align="absmiddle" /></a>&nbsp;<a href="listusers.php"><img src="pic/user.gif" width="118" height="30" border="0" align="absmiddle" /></a>&nbsp;<a href="logout.php"><img src="pic/logout.gif" alt="ออกจากระบบ" width="122" height="30" border="0" align="absmiddle" /></a>&nbsp;</td>
            </tr>
          </table></td>
        </tr>
      </table>
    </div></td>
  </tr>
  <tr>
    <td height="400" background="body.gif"><table width="650" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="400" background="pic/adfrm.gif"><table width="730" height="400" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td height="400" align="center" valign="top">
			
			<table width="730" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td height="22" align="right" valign="bottom"><span class="style3">วันที่
                      <?include "date.php";?>
&nbsp; </span></td>
                </tr>
              </table>
			
			<table width="730" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="52" height="351">&nbsp;</td>
                <td width="630" valign="top" background="pic/book06.gif"><table width="630" height="343" border="0" align="center" cellpadding="0" cellspacing="0">
                  <tr>
                    <td height="1">&nbsp;</td>
                    <td height="1">&nbsp;</td>
                    <td height="1">&nbsp;</td>
                    <td height="1">&nbsp;</td>
                  </tr>
                  <tr>
                    <td height="31">&nbsp;</td>
                    <td height="31">&nbsp;</td>
                    <td height="31">&nbsp;</td>
                    <td height="31">&nbsp;</td>
                  </tr>
                  <?
			  $snum = "SELECT MAX(id) as id FROM tbres";
$rnum = mysql_query($snum) or die ("ไม่สามารถ Select id ได้");
while($row = mysql_fetch_array($rnum))
     {//-
          if($row != 'NULL')
          { //ถ้าฟิวด์ id_brand มีข้อมูลอยู่แล้วให้ +1
          $id = $row["id"]+1;
		  //echo $id;
          }
               else { $id = 1; }
     }//-
            ?>
			  <FORM name="frm1" METHOD=POST ACTION="insert_admin.php" >
              <tr>
                <td height="20">&nbsp;</td>
                <td height="20" align="right" valign="top">เรื่องการประชุม :&nbsp;</td>
                <td height="20" align="left" valign="middle">&nbsp;
                  <textarea name="txttit"></textarea></td>
                <td height="20">&nbsp;</td>
              </tr>
                    <tr>
                      <td height="25">&nbsp;</td>
                      <td height="25"><div align="right">ห้องประชุม :&nbsp;</div></td>
                      <td height="25"><div align="left">&nbsp;
                              <select name="roomddl" size="1" id="roomddl">
                                <option>-- เลือกห้องประชุม --</option>
                                <option value="1">ห้องประชุม 1</option>
                                <option value="2">ห้องประชุม 2</option>
                              </select>
                      </div></td>
                      <td height="25">&nbsp;</td>
                    </tr>
                    <tr>
                      <td width="71" height="25">&nbsp;</td>
                      <td width="237" height="25"><div align="right">วันที่ต้องการจอง :&nbsp;</div></td>
                      <td width="257" height="25"><div align="left">&nbsp;
                              <input name="txtdate" id="popup_container" type="date" size="10"/>
                              <input type="hidden" name="id" value="<?=$id?>" />
                      </div></td>
                      <td width="65" height="25">&nbsp;</td>
                    </tr>
                    <tr>
                      <td height="25">&nbsp;</td>
                      <td height="25"><div align="right">ช่วงเวลา :&nbsp;</div></td>
                      <td height="25"><div align="left">&nbsp;
                              <select name="timedll" id="timedll">
                                <option>--เลือกช่วงเวลา --</option>
                                <option value="1">เช้า</option>
                                <option value="2">บ่าย</option>
                                <option value="3">เช้า - บ่าย</option>
                              </select>
                      </div></td>
                      <td height="25">&nbsp;</td>
                    </tr>
                    <tr>
                      <td height="25">&nbsp;</td>
                      <td height="25"><div align="right">ชื่อผู้จอง :&nbsp;</div></td>
                      <td height="25"><div align="left">&nbsp;
                              <input name="namerestxt" type="text" size="25" />
                      </div></td>
                      <td height="25">&nbsp;</td>
                    </tr>
                    <tr>
                      <td height="25">&nbsp;</td>
                      <td height="25"><div align="right">หน่วยงาน :&nbsp;</div></td>
                      <td height="25"><div align="left">&nbsp;
                          <input name="nameunit" type="text" value="<?echo $_SESSION['name_units'];?>" size="16" readonly="readonly" />
                        <input name="txtunit" type="hidden" value="<?echo $_SESSION['units'];?>" size="18" readonly="readonly" />
                      </div></td>
                      <td height="25">&nbsp;</td>
                    </tr>
					<tr>
                <td height="25">&nbsp;</td>
                <td height="25"><div align="right">เบอร์ติดต่อ :&nbsp;</div></td>
                <td height="25" align="left" valign="top">&nbsp;
                  <INPUT NAME="txttell" TYPE="text" size="10" maxlength="10"></td>
                <td height="25">&nbsp;</td>
              </tr>
                    <tr>
                      <td height="105">&nbsp;</td>
                      <td height="105">&nbsp;</td>
                      <td height="105" align="right" valign="top">
				  <img src="pic/submit1.gif" alt="กดเพื่อจองห้องประชุม" width="73" height="54" border="0" align="top" style="cursor:hand" onclick="JavaScript:return fncSubmit();"/></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
                      <td height="105">&nbsp;</td>
                    </tr>
                  </form>
                </table></td>
                <td width="48">&nbsp;</td>
              </tr>
            </table></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td valign="middle">&nbsp;</td>
  </tr>
  <tr>
    <td><img src="pic/foot_admin.gif" width="730" height="70" /></td>
  </tr>
</table>
</body>
<?mysql_close();?>
</html>


Date : 2009-10-08 11:09:26 By : oasiis
 


 

No. 25



โพสกระทู้ ( 942 )
บทความ ( 0 )



สถานะออฟไลน์


ยาวโคด โคดยาวเลย ติดปัญหาตรงไหนเนี่ย

เอาแค่ที่ติดปัญหามาก็พอแล้ว
Date : 2009-10-08 11:18:46 By : NanoThoro
 


 

No. 26



โพสกระทู้ ( 613 )
บทความ ( 0 )



สถานะออฟไลน์


บรรทัดที่ 26

Code (PHP)
<script language="javascript">
var d = new Date();
var nTime = d.toTimeString();
var nDate = d.toYMDString();

function fncSubmit()
{
	if(document.frm1.txttit.value == "")
	{
		alert('!!! กรุณาใส่ชื่อเรื่องการประชุม');
		document.frm1.txttit.focus();
		return false;
	}	
	if(document.frm1.roomddl.value <1)
	{
		alert('!!! กรุณาเลือกห้องประชุม');
		document.frm1.roomddl.focus();		
		return false;
	}	
	if(document.frm1.txtdate.value == "")
	{
		alert('!!! กรุณาใส่วันที่ต้องการจอง');
		document.frm1.txtdate.focus();
		return false;
	}
	if(document.frm1.txtdate.value <= nDate)
	{
		alert('!!! คุณกำลังจองวันที่ย้องหลัง');
		document.frm1.txtdate.focus();
		return false;
	}
	if(document.frm1.timedll.value <1)
	{
		alert('!!! กรุณาเลือกเวลาที่ต้องการจอง');
		document.frm1.timedll.focus();
		return false;
	}
	if(document.frm1.namerestxt.value == "")
	{
		alert('!!! กรุณาใส่ชื่อผู้จอง');
		document.frm1.namerestxt.focus();
		return false;
	}
	if(document.frm1.txttell.value == "")
	{
		alert('!!! กรุณาใส่เบอร์ติดต่อ');
		document.frm1.txttell.focus();
		return false;
	}
	document.frm1.submit();
}
</script>

Date : 2009-10-08 11:25:47 By : oasiis
 


 

No. 27



โพสกระทู้ ( 942 )
บทความ ( 0 )



สถานะออฟไลน์


Date.prototype.toYMDString = function () {return isNaN (this) ? 'NaN' : [this.getFullYear(), this.getMonth() > 8 ? this.getMonth() + 1 : '0' + (this.getMonth() + 1), this.getDate() > 9 ? this.getDate() : '0' + this.getDate()].join('-')}

เพิ่มบันทัดนี้เข้าไป หลัง <script language="javascript">
Date : 2009-10-08 11:35:48 By : NanoThoro
 


 

No. 28



โพสกระทู้ ( 613 )
บทความ ( 0 )



สถานะออฟไลน์


Quote:
Date.prototype.toYMDString = function () {return isNaN (this) ? 'NaN' : [this.getFullYear(), this.getMonth() > 8 ? this.getMonth() + 1 : '0' + (this.getMonth() + 1), this.getDate() > 9 ? this.getDate() : '0' + this.getDate()].join('-')}


เป็นวันที่ปัจจุบันหรอ ครับ ช่วยอธิบายหน่อยได้มั้ยครับ
Date : 2009-10-08 11:43:14 By : oasiis
 


 

No. 29



โพสกระทู้ ( 942 )
บทความ ( 0 )



สถานะออฟไลน์


ไม่ใช่ คำสั่งนั้นเพิ่มโปรโตไทน์ เข้าไปในฟังก์ชั่น Dat ของจาว่าสคริป เพื่อเพิ่มรูปแบบวันที่ เนื่องจากว่าวันที่แบบ Y-M-D ในจาว่าปกติไม่มีครับ

คำสั่งที่หาวันที่ปัจจุบัน วเลาปัจจุบันได้ให้ไปแล้ว คุณเอาไปใช้แล้วนี่
Date : 2009-10-08 11:46:08 By : NanoThoro
 


 

No. 30



โพสกระทู้ ( 613 )
บทความ ( 0 )



สถานะออฟไลน์


ขอบคุณมากครับคุณ นาโน
ถึงแม้ผมจะไม่ค่อยเข้าโค้ด
Date : 2009-10-08 11:53:59 By : oasiis
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : เรื่องการตรวจสอบค่าว่าง ก่อนทำการ insert คือผมใช้รูปภาพแทนปุ่ม submit แต่มันไม่ยอมเข้า function
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 00
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่