 |
|
ผมลองแล้วน่ะครับ หาไม่เจอว่าผิดตรงไหน มันออกมาเป็น yes หมดเลยน่ะครับ
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script type="text/javascript" src="javascriptfile/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#Function_Sel").hide();
$("#Center_Sel").change( function(){
$("#showtext").html('Retrieving ...');
$.ajax({
type: "POST",
data: "data=" + $(this).val(),
url: "ceneqprocess.php",
success: function(msg)
{
if (msg != '')
{
//$("#Function_Sel").html(msg).show();
$("#showtext").html('yes');
}
else
{
//$("#showtext").html('<em>No item result</em>');
$("#showtext").html('no');
}
}
});
});
});
</script>
</head>
<body>
<div align="center">
<form method="get" name="form_CF" id="form_CF">
<strong>Center No. </strong>
<select name="Center_Sel" id="Center_Sel">
<?php
include 'connect.php';
$conn->open($msaccdb);
$str = "SELECT tb_Center.* FROM tb_Center";
$Rec->open($str, $conn, 1, 3);
?>
<option value="" selected="selected" disabled="disabled">เลือก Center</option>
<?php
while (!$Rec->EOF)
{
?>
<option value="<?=$Rec->Fields['ID_Center']->Value ?>"><?=$Rec->Fields['CenterNo']->Value ?></option>
<?php
$Rec->MoveNext();
}
$Rec->Close();
$conn->Close();
?>
</select>
<strong>Function</strong>
<select name="Function_Sel" id="Function_Sel"></select>
<button type="submit" name="Summit_CF" id="Summit_CF" value="Submit">Submit</button>
<div id="showtext"></div>
</form>
</div>
</body>
</html>
Code (PHP)
$centerid = $_POST['data'];
//$centerid = 6;
include 'connect.php';
$conn->open($msaccdb);
$str = "SELECT tb_Center_Function.*, tb_Function.*
FROM tb_Center_Function, tb_Function
WHERE tb_Center_Function.ID_Function = tb_Function.ID_Function
AND tb_Center_Function.ID_Center LIKE $centerid
AND tb_Center_Function.Status LIKE TRUE
ORDER BY Date_Log";
$Rec->open($str, $conn, 1, 3);
//echo $str;
$TotalRecord = $Rec->RecordCount();
if ($TotalRecord >= 1)
{
echo "hello!!";
}
Tag : PHP, JavaScript, Ajax, jQuery
|
|
 |
 |
 |
 |
Date :
2011-06-08 16:29:52 |
By :
PikaboyZ |
View :
825 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |