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,027

HOME > PHP > PHP Forum > ช่วยผมทีคับ เช็คค่าว่าง ให้แจ้งเมื่อมีค่าว่างอ่ะคับ ต้องเพิ่มตรงไหนคับ



 

ช่วยผมทีคับ เช็คค่าว่าง ให้แจ้งเมื่อมีค่าว่างอ่ะคับ ต้องเพิ่มตรงไหนคับ

 



Topic : 083224

Guest




<?
$objConnect = mysql_connect("localhost","root","123") or die("Error Connect to Database");
$objDB = mysql_select_db("av_movierental");
mysql_query("SET NAMES UTF8");

if($_GET["Action"] == "Save")
{
//*** Insert Question ***//
$strSQL = "INSERT INTO webboard ";
$strSQL .="(CreateDate,Question,Details,Name) ";
$strSQL .="VALUES ";
$strSQL .="('".date("Y-m-d H:i:s")."','".$_POST["txtQuestion"]."','".$_POST["txtDetails"]."','".$_POST["txtName"]."') ";
$objQuery = mysql_query($strSQL);

header("location:Webboard.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>

<style type="text/css">
<!--
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
body {
background-image: url(img/bg-home1.jpg);
background-repeat: repeat;
background-attachment:fixed;
}
-->
</style>
<script src="Scripts/swfobject_modified.js" type="text/javascript"></script>
</head>
<body>


<table width="1002" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<th scope="col" width="1002" height="220"><img src="img/h1.gif" width="1006" height="230" align="top" /></th>
</tr>
<td> <table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="39%"><div align="center">
<table id="Table_01" width="114" height="22" border="0" cellpadding="0" cellspacing="5">
<tr>
<th scope="col"><a href="index.php"><img src="img/img1.gif" width="200" height="49" border="0" /></a></th>
<th scope="col"><a href="detailshop.php"><img src="img/img2.gif" width="200" height="49" border="0" /></a></th>
<th scope="col"><a href="webboard.php"><img src="img/img3.gif" width="200" height="49" border="0" /></a></th>
<th scope="col"><a href="admin"><img src="img/img4.gif" width="200" height="49" border="0" /></a></th>
</tr>
</table>
</div></td>
</tr>
<tr>
<th scope="col"><table width="954" border="0" cellspacing="0" cellpadding="0">
<tr>

</tr>
<tr>
<th scope="col"><table width="1006" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="500" align="center" valign="top" bgcolor="#FFFFFF" scope="col"><p>&nbsp;</p>
<html>
<head>
<title>เว็บบอร์ด</title>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
</head>
<body>

<form action="NewQuestion.php?Action=Save" method="post" name="frmMain" id="frmMain">
<table width="621" border="1" cellpadding="1" cellspacing="1">

<tr>
<td>หัวข้อ</td>
<td><input name="txtQuestion" type="text" id="txtQuestion" value="" size="70"></td>
</tr>
<tr>
<td width="78">รายละเอียด</td>
<td><textarea name="txtDetails" cols="50" rows="5" id="txtDetails"></textarea></td>
</tr>
<tr>
<td width="78">ชื่อ</td>
<td width="647"><input name="txtName" type="text" id="txtName" value="" size="50"></td>
</tr>
</table>

<input name="btnSave" type="submit" id="btnSave" value="ตกลง">
</form>
</body>
</html>
<?
mysql_close($objConnect);
?>


<tr>
<th height="100" scope="col"><img src="img/f1.jpg" width="1006" height="100" /></th>
</tr>
</table></th>
</tr>
</table></th>
</tr>
</table>
<script type="text/javascript">
swfobject.registerObject("FlashID");
</script>
</body>
</html>
Code (PHP)
Code (PHP)
[php]

[/php]



Tag : PHP, MySQL







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2012-08-31 10:35:28 By : nuthekop View : 1057 Reply : 3
 

 

No. 1



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



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


ประมาณนี้ป่าวครับที่ต้องการ
Code (PHP)
<?
$objConnect = mysql_connect("localhost","root","123") or die("Error Connect to Database");
$objDB = mysql_select_db("av_movierental");
mysql_query("SET NAMES UTF8");

if($_GET["Action"] == "Save")
{
	if(($_POST["txtQuestion"]=='') || ($_POST["txtDetails"]=='') || ($_POST["txtName"]=='')){  //เช็คค่าว่าง
		echo 'กรุณากรอกข้อมูลให้ครบ!!!';
	}else{
		//*** Insert Question ***//
		$strSQL = "INSERT INTO webboard ";
		$strSQL .="(CreateDate,Question,Details,Name) ";
		$strSQL .="VALUES ";
		$strSQL .="('".date("Y-m-d H:i:s")."','".$_POST["txtQuestion"]."','".$_POST["txtDetails"]."','".$_POST["txtName"]."') ";
		$objQuery = mysql_query($strSQL);
		
		header("location:Webboard.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>

<style type="text/css">
<!--
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
body {
background-image: url(img/bg-home1.jpg);
background-repeat: repeat;
background-attachment:fixed;
}
-->
</style>
<script src="Scripts/swfobject_modified.js" type="text/javascript"></script>
</head>
<body>


<table width="1002" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<th scope="col" width="1002" height="220"><img src="img/h1.gif" width="1006" height="230" align="top" /></th>
</tr>
<td> <table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="39%"><div align="center">
<table id="Table_01" width="114" height="22" border="0" cellpadding="0" cellspacing="5">
<tr>
<th scope="col"><a href="index.php"><img src="img/img1.gif" width="200" height="49" border="0" /></a></th>
<th scope="col"><a href="detailshop.php"><img src="img/img2.gif" width="200" height="49" border="0" /></a></th>
<th scope="col"><a href="webboard.php"><img src="img/img3.gif" width="200" height="49" border="0" /></a></th>
<th scope="col"><a href="admin"><img src="img/img4.gif" width="200" height="49" border="0" /></a></th>
</tr>
</table>
</div></td>
</tr>
<tr>
<th scope="col"><table width="954" border="0" cellspacing="0" cellpadding="0">
<tr>

</tr>
<tr>
<th scope="col"><table width="1006" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="500" align="center" valign="top" bgcolor="#FFFFFF" scope="col"><p>&nbsp;</p>
<html>
<head>
<title>เว็บบอร์ด</title>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
</head>
<body>

<form action="NewQuestion.php?Action=Save" method="post" name="frmMain" id="frmMain">
<table width="621" border="1" cellpadding="1" cellspacing="1">

<tr>
<td>หัวข้อ</td>
<td><input name="txtQuestion" type="text" id="txtQuestion" value="" size="70"></td>
</tr>
<tr>
<td width="78">รายละเอียด</td>
<td><textarea name="txtDetails" cols="50" rows="5" id="txtDetails"></textarea></td>
</tr>
<tr>
<td width="78">ชื่อ</td>
<td width="647"><input name="txtName" type="text" id="txtName" value="" size="50"></td>
</tr>
</table>

<input name="btnSave" type="submit" id="btnSave" value="ตกลง">
</form>
</body>
</html>
<?
mysql_close($objConnect);
?>


<tr>
<th height="100" scope="col"><img src="img/f1.jpg" width="1006" height="100" /></th>
</tr>
</table></th>
</tr>
</table></th>
</tr>
</table>
<script type="text/javascript">
swfobject.registerObject("FlashID");
</script>
</body>
</html>







แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-08-31 10:46:06 By : arm8957
 


 

No. 2



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



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

Code (PHP)
<html>
<head>
<title>ThaiCreate.Com Tutorial</title>
</head>
<body>
<script language="javascript">
function fncSubmit()
{
	if(document.form1.txt1.value == "")
	{
		alert('Please input Input 1');
		document.form1.txt1.focus();
		return false;
	}	
	if(document.form1.txt2.value == "")
	{
		alert('Please input Input 2');
		document.form1.txt2.focus();		
		return false;
	}	
	document.form1.submit();
}
</script>
<form action="page.cgi" method="post" name="form1" onSubmit="JavaScript:return fncSubmit();">
Input 1 <input name="txt1" type="text"><br>
Input 2 <input name="txt2" type="text"><br>
<input name="btnSubmit1" type="submit" value="Submit" >
</form>
</body>
</html>

ตรง <form> เพิ่ม onSubmit="JavaScript:return fncSubmit();"

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-08-31 10:48:52 By : pumin99
 

 

No. 3

Guest


ตอบความคิดเห็นที่ : 1 เขียนโดย : arm8957 เมื่อวันที่ 2012-08-31 10:46:06
รายละเอียดของการตอบ ::

.คับผมใช่เลยคับ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-08-31 11:04:16 By : nuthekop
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ช่วยผมทีคับ เช็คค่าว่าง ให้แจ้งเมื่อมีค่าว่างอ่ะคับ ต้องเพิ่มตรงไหนคับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ 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 05
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 อัตราราคา คลิกที่นี่