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

HOME > PHP > PHP Forum > ตรวจสอบค่าว่างด้วย java script ใส่ code ตรงไหนครับแก้แล้วใช้ไม่ได้



 

ตรวจสอบค่าว่างด้วย java script ใส่ code ตรงไหนครับแก้แล้วใช้ไม่ได้

 



Topic : 018039

Guest




<?php require_once('Connections/promoweb.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO job (id_job, detail, `domain`, `group`, `user`, tel, `time`, status) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['id_job'], "int"),
GetSQLValueString($_POST['detail'], "text"),
GetSQLValueString($_POST['domain'], "text"),
GetSQLValueString($_POST['group'], "text"),
GetSQLValueString($_POST['user'], "text"),
GetSQLValueString($_POST['tel'], "text"),
GetSQLValueString($_POST['time'], "text"),
GetSQLValueString($_POST['status'], "text"));

mysql_select_db($database_promoweb, $promoweb);
$Result1 = mysql_query($insertSQL, $promoweb) or die(mysql_error());

$insertGoTo = "index.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}

$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;

mysql_select_db($database_promoweb, $promoweb);
$query_Recordset1 = "SELECT * FROM job WHERE status = 'Job Require' ORDER BY `time` DESC";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $promoweb) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);

if (isset($_GET['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;

mysql_select_db($database_promoweb, $promoweb);
$query_Recordset2 = "SELECT * FROM job WHERE status = 'ok' ORDER BY id_job DESC";
$Recordset2 = mysql_query($query_Recordset2, $promoweb) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
?>
<!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>True Visions</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style4 {font-size: small}
.style5 {font-size: 12px}
.style7 {
color: #000066;
font-weight: bold;
}
.style9 {font-size: small; color: #FF0000; }
-->
</style>
</head>

<body>

<table width="779" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><table width="30%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="redbox">&nbsp;</td>
</tr>
<tr>
<td height="45"><a href="index.html" class="logo">True Visions</a></td>
</tr>
<tr>
<td><a href="index.html" class="tag">Promo</a></td>
</tr>
</table></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td bgcolor="#E2E2D2" class="border" height="40"><table width="90%" border="0" cellpadding="0" cellspacing="0">
<tr align="center">
<td width="24%"><a href="index.html" class="toplinks">Main</a></td>
<td width="1%" class="toplinks">|</td>
<td width="21%"><a href="index.html" class="toplinks">Job</a></td>
<td width="1%" class="toplinks">|</td>
<td width="28%"><a href="index.html" class="toplinks">Admin</a></td>
<td width="1%" class="toplinks">|</td>
<td width="37%"><a href="index.html" class="toplinks">Contact</a></td>
</tr>
</table></td>
</tr>
<tr>
<td height="10"></td>
</tr>

<tr>
<td bgcolor="#F3F3F3" class="border"><p align="center" class="style7">Add Job</p>


คิดว่าใส่ตรงนี้


<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
<table width="314" border="1" align="center" cellpadding="0" cellspacing="0">
<tr valign="baseline">
<td width="49" align="right" valign="top" nowrap>Detail:</td>
<td colspan="2"><textarea name="detail" cols="30" rows="3" wrap="VIRTUAL"></textarea>
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Domain:</td>
<td width="111"><select name="domain">
<option value="Domain A" <?php if (!(strcmp("Domain A", ""))) {echo "SELECTED";} ?>>Domain A</option>
<option value="Domain E" <?php if (!(strcmp("Domain E", ""))) {echo "SELECTED";} ?>>Domain E</option>
</select>
</td>
<td width="155">Group:
<select name="group">
<option value="ENT" <?php if (!(strcmp("ENT", ""))) {echo "SELECTED";} ?>>ENT</option>
<option value="COR" <?php if (!(strcmp("COR", ""))) {echo "SELECTED";} ?>>COR</option>
<option value="FIL" <?php if (!(strcmp("FIL", ""))) {echo "SELECTED";} ?>>FIL</option>
<option value="SPO" <?php if (!(strcmp("SPO", ""))) {echo "SELECTED";} ?>>SPO</option>
<option value="NLE" <?php if (!(strcmp("NLE", ""))) {echo "SELECTED";} ?>>NLE</option>
</select></td>
</tr>
<tr valign="baseline">
<td height="24" align="right" nowrap>User:</td>
<td><input type="text" name="user" value="" size="13"> </td>
<td>Tel:
<input type="text" name="tel" value="" size="13" /></td>
</tr>

<tr valign="baseline">
<td height="26" align="right" nowrap>&nbsp;</td>
<td colspan="2"><div align="center">
<input type="submit" value="Send">
<input type="reset" name="Reset" value="Clear" />
</div></td>
</tr>
</table>
<input type="hidden" name="id_job" value="">
<input type="hidden" name="time" value="<?
# $day = date("D j M Y, g:i:s A");
#setlocale ("LC_TIME", "th");
$day = strftime("%A"); //บอกวัน จันทร์,อังคาร
$d = date("j");
$m = strftime("%b");
# $dm = strftime("%d %b "); // d บอก วันที่ 1-31 b บอก เดื่อนเป็นตัวย่อ B บอกเดือนแบบเต็ม
$yea = date("Y")+543;
$tim = strftime("%H:%M:%S");
$fullday = "$d $m $yea $tim";
echo $fullday;
?>">
<input type="hidden" name="status" value="Job Require">
<input type="hidden" name="MM_insert" value="form1">
</form>
<p align="center" class="style7">Job Require</p>
<table width="96%" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<th width="4%" scope="col">No</th>
<th width="23%" scope="col">Detail</th>
<th width="15%" scope="col">Domain</th>
<th width="14%" scope="col">Group</th>
<th width="13%" scope="col">User</th>
<th width="12%" scope="col">Tel</th>
<th width="19%" scope="col">Time</th>
</tr>
<?php do { ?>
<tr>
<td><div align="center"><span class="style4"><?php echo $row_Recordset1['id_job']; ?></span></div></td>
<td><div align="center"><span class="style4"><?php echo $row_Recordset1['detail']; ?></span></div></td>
<td><div align="center"><span class="style4"><?php echo $row_Recordset1['domain']; ?></span></div></td>
<td><div align="center"><span class="style5"><?php echo $row_Recordset1['group']; ?></span></div></td>
<td><div align="center"><span class="style4"><?php echo $row_Recordset1['user']; ?></span></div></td>
<td><div align="center"><span class="style4"><?php echo $row_Recordset1['tel']; ?></span></div></td>
<td><div align="center"><span class="style9"><?php echo $row_Recordset1['time']; ?></span></div></td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
<p align="center" class="style7"> Job Complete</p>
<table width="96%" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<th width="4%" scope="col">No</th>
<th width="23%" scope="col">Detail</th>
<th width="15%" scope="col">Domain</th>
<th width="14%" scope="col">Group</th>
<th width="13%" scope="col">User</th>
<th width="12%" scope="col">Tel</th>
<th width="19%" scope="col">Time</th>
</tr>
<tr>
<td><div align="center"><?php echo $row_Recordset2['id_job']; ?></div></td>
<td><div align="center"><?php echo $row_Recordset2['detail']; ?></div></td>
<td><div align="center"><?php echo $row_Recordset2['domain']; ?></div></td>
<td><div align="center"><?php echo $row_Recordset2['group']; ?></div></td>
<td><div align="center"><?php echo $row_Recordset2['user']; ?></div></td>
<td><div align="center"><?php echo $row_Recordset2['tel']; ?></div></td>
<td><div align="center"><?php echo $row_Recordset2['time']; ?></div></td>
</tr>
</table> <p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p></td>
</tr>
<tr>
<td><table width="100%" border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td class="copybox">All Right Reserved &copy; 2007, Designed by <a href="http://www.cmgtechnologies.com/" title="Designed by CMG Technologies" class="links">CMG Technologies</a>, <a href="http://www.text-link-ads.com/starter_kit.php?ref=2503" target="_blank" class="links">$100 in FREE Links</a>, <a href="http://www.powertheweb.com/" target="_blank" class="links">Power the Web</a> &amp; <a href="http://www.stylishblog.com/" target="_blank" class="links">Stylish Blog</a>.</td>
</tr>
</table></td>
</tr>
<tr>
<td height="10">&nbsp;</td>
</tr>
</table>

<div style="font-size: 0.8em; text-align: center; margin-top: 1.0em; margin-bottom: 1.0em;">
Design downloaded from <a href="http://www.freewebtemplates.com/">Free Templates</a> - your source for free web templates
</div>
</body>
</html>
<?php
mysql_free_result($Recordset1);

mysql_free_result($Recordset2);
?>



Tag : - - - -







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 30 ม.ค. 2551 06:39:45 By : slam View : 2540 Reply : 2
 

 

No. 1



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



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


โอยยาว อยากได้ตรวจสอบ ถ้า ฟิว text มันเป็น ค่าว่าง แล้วให้มันเด้ง บอกอะป่าวถ้าใช่มีสั้นกว่านี้






Date : 30 ม.ค. 2551 10:59:38 By : xboy
 


 

No. 2

Guest


ข้างบนมันเป็น Source ครับไม่ใช่ code เช็คค่าว่าง


ตรวจสอบค่าว่างด้วย java script


Sample

<script language="JavaScript">
<!-- Begin
function checkFields2() {
missinginfo = "";
if (document.regis.user.value == "") {
missinginfo += "\n - * ชื่อ user";
}
if (document.regis.pass.value == "") {
missinginfo += "\n - * รหัสผ่าน";
}
if (document.regis.topic_s.value == "") {
missinginfo += "\n - * หัวข้อ ";
}
if (document.regis.comment.value == "") {
missinginfo += "\n - * รายละเอียด ปัญหา";
}
if (missinginfo != "") {
missinginfo ="_____________________________\n" +
"ท่านกรอกข้อมูลไม่ถูกต้องในช่องต่อไปนี้ :\n" +
missinginfo + "\n_____________________________" +
"\nกรุณากลับไปกรอกอีกครั้ง ";
alert(missinginfo);
return false;
}
else return true;
}
// End -->
</script>
<form method="POST" action="" name="regis" onSubmit="return checkFields2();" >

คือตัวนี้ครับที่จะใช้ แต่ไม่ทราบว่าจะต้องไปว่างไว้ที่ไหนครับ ขอ' code ด้านบน
อยากให้ช่วยหน่อยครับ ผมจะทำต่อคืนนี้ขอบคุณครับ
Date : 30 ม.ค. 2551 16:30:19 By : slam
 

   

ค้นหาข้อมูล


   
 

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