|
|
|
ช่วยดูโค้ดหน้านี้ให้หน่อยคะ ปฏิทินไม่ขึ้น แล้วก็ไม่เก็บเข้า database เขียนตรงไหนผิดหรือคะ? |
|
|
|
|
|
|
|
Code (PHP)
<?
session_start();
include "config.php";
if($_GET['id_cus'] OR $_GET['id_pro']) {
$sql_check_updated = "SELECT p.*, j.status, j.detail, j.filename1, j.filename2, j.filename3, j.filename4, j.firstdate_job, j.enddate_job
FROM tbl_project as p
JOIN tbl_job as j ON j.ref_id_pro = p.id_pro
WHERE p.id_pro = '".$_GET['id_pro']."' ";
$query_check_updated = mysql_query($sql_check_updated);
while($result_check_updated = mysql_fetch_array($query_check_updated)) {
$str_start_date = $result_check_updated['start_date'];
$str_end_date = $result_check_updated['end_date'];
$str_ref_id_staff = $result_check_updated['ref_id_staff'];
$str_remark = $result_check_updated['remark'];
/*$str_status = $result_check_updated['status'];
$str_detail = $result_check_updated['detail'];
$str_filename1 = $result_check_updated['filename1'];
$str_filename2 = $result_check_updated['filename2'];
$str_filename3 = $result_check_updated['filename3'];
$str_filename4 = $result_check_updated['filename4'];
$str_firstdate_job = $result_check_updated['firstdate_job'];
$str_enddate_job = $result_check_updated['enddate_job'];*/
}
if($str_start_date != '0000-00-00' AND $str_end_date != '0000-00-00' AND $str_ref_id_staff != '') {
$updated = 1;
}
else {
$updated = 0;
}
/*if($str_status != '' AND $str_firstdate_job != '0000-00-00' AND $str_enddate_job != '') {
$updated2 = 1;
}
else {
$updated2 = 0;
}*/
$sql = "SELECT p.* , c.* FROM tbl_project p
JOIN tbl_cus_project cp ON cp.id_pro = p.id_pro
JOIN tbl_cus c ON c.id_cus = cp.id_cus
WHERE p.id_pro = ".$_GET['id_pro']." ";
$query = mysql_query($sql) or die ('Error Query ['.$sql.']');
while($result = mysql_fetch_array($query)) {
$txt_name = $result['name'];
$txt_lastname = $result['lastname'];
$txt_name_pro = $result['name_pro'];
$txt_location = $result['location'];
$txt_phone = $result['phone'];
$txt_tel = $result['tel'];
$txt_email = $result['email'];
}
}
?>
<!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" />
<link href="jquery/jquery-ui.min.css" rel="stylesheet" type="text/css" media="all" />
<title>mdu customer</title>
<!-- CSS -->
<link href="style/css/transdmin.css" rel="stylesheet" type="text/css" media="screen" />
<!--[if IE 6]><link rel="stylesheet" type="text/css" media="screen" href="style/css/ie6.css" /><![endif]-->
<!--[if IE 7]><link rel="stylesheet" type="text/css" media="screen" href="style/css/ie7.css" /><![endif]-->
<!-- JavaScripts-->
<script type="text/javascript" src="style/js/jquery.js"></script>
<script type="text/javascript" src="style/js/jNice.js"></script>
<script type="text/javascript" src="jquery/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="jquery/jquery-ui.min.js"></script>
<script type="text/javascript" src="jquery/jquery.form.js"></script>
<link href="jquery/jquery-ui.min.css" rel="stylesheet" type="text/css" media="all" />
<script>
$(document).ready(function() {
$("#start_date, #end_date, #firstdate_job, #enddate_job").datepicker({
changeMonth: true,
changeYear: true,
showButtonPanel: true,
dateFormat: "yy-mm-dd",
})
}
);
/*var updated = '<?=$updated;?>';
var updated2 = '<?=$updated2;?>';*/
var id_cus = '<?=$_GET['id_cus'];?>';
var id_pro = '<?=$_GET['id_pro'];?>';
if(updated != '1') {
$('#step_2').show();
$('#step_3').hide();
if(id_cus != '' || id_pro != '') {
$('#step_2').show();
$('frmfile').show();
$('#submit_step_2').click(function() {
var id_cus = '<?=$_GET['id_cus'];?>';
var id_pro = '<?=$_GET['id_pro'];?>';
var start_date = $('#start_date').val();
var end_date = $('#end_date').val();
var namestaff = $('#namestaff').val();
var remark = $('#remark').val();
if(start_date == '') {
alert('กรุณาระบุวันที่เริ่มโครงการ');
}
if(end_date == '') {
alert('กรุณาระบุวันที่เสร็จสิ้นโครงการ');
}
if(namestaff == '') {
alert('กรุณาระบุผู้รับผิดชอบโครงการ');
}
else {
$.ajax({
type: "POST",
url: "add_detailjob.php",
data: "id_cus=" + id_cus + "&id_pro=" + id_pro + "&start_date=" + start_date + "&end_date=" + end_date + "&namestaff=" + namestaff + "&remark=" + remark,
success: function(server_response) {
$(document).ajaxComplete(function() {
//$('#namestaff').attr('disabled', '');
$('#remark').attr('disabled', '');
$('#submit_step_2').hide();
$('#reset_step_2').hide();
});
}
});
</script>
</head>
<?php
if($_GET['id_cus']) {
$sql = 'SELECT *
FROM tbl_cus c INNER JOIN tbl_project p ON c.ref_id_pro = p.id_pro
WHERE id_cus = "'.$_GET['id_cus'].'" ';
$sql = "SELECT c.* , p.* FROM tbl_cus c
JOIN tbl_cus_project cp ON cp.id_cus = c.id_cus
JOIN tbl_project p ON p.id_pro = cp.id_pro
WHERE c.id_cus = '".$_GET['id_cus']."' ";
$query = mysql_query($sql) or die ('Error Query ['.$sql.']');
while($result = mysql_fetch_array($query)) {
$txt_name = $result['name'];
$txt_lastname = $result['lastname'];
$txt_name_pro = $result['name_pro'];
$txt_location = $result['location'];
$txt_phone = $result['phone'];
$txt_tel = $result['tel'];
$txt_email = $result['email'];
}
}
?>
<body>
<div id="wrapper">
<!-- h1 tag stays for the logo, you can use the a tag for linking the index page -->
<h1> </h1>
<!-- You can name the links with lowercase, they will be transformed to uppercase by CSS, we prefered to name them with uppercase to have the same effect with disabled stylesheet -->
<ul id="mainNav">
<li><a href="list.php" >HOME</a></li> <!-- Use the "active" class for the active menu item -->
<li><a href="detailjob.php" class="active">MDU PROJECT</a></li>
<li><a href="history.php">HISTORY</a></li>
<li><a href="logout.php">LOGOUT</a></li>
<li class="logout"><a href="#"> <?="LOGIN ID:" .$_SESSION["username"];?></a></li>
</ul>
<!-- // #end mainNav -->
<div id="containerHolder">
<div id="container">
<!-- // #sidebar -->
<!-- h2 stays for breadcrumbs -->
<form action="" method="POST" name="step_2" id="step_2" enctype="multipart/form-data">
<?
if($_GET['id_cus']) {
echo '<input type="hidden" name="txt_id_cus" value="'.$_GET['id_cus'].'" />';
}
?>
<h2> <a href="detailjob.php" class="active" >บันทึกรายละเอียดโครงการ</a> » <a href="detailjob1.php" >บันทึกขั้นตอนงาน</a></h2>
<p> </p>
<p> </p>
<p> </p>
<table width="80%" border="5"align="center">
<tr >
<td width="2%" height="35" >โครงการ</td>
<script language="javascript">
function js_popup(theURL,width,height) { //v2.0
leftpos = (screen.availWidth - width) / 2;
toppos = (screen.availHeight - height) / 2;
window.open(theURL, "viewdetails","width=" + width + ",height=" + height + ",left=" + leftpos + ",top=" + toppos);
}
</script>
<a href="#" onClick="js_popup('btnsearch.php',783,600); return false;" title="Code PHP Popup">
<td width="28%"><input name="txt_name_pro" type="text" id="txt_name_pro" value="<?=$txt_name_pro;?>" readonly="readonly" />
<a href=" " onclick="js_popup('btnsearch.php',783,600); return false;" title="Code PHP Popup" ><img src="image/search.png" alt="" width="20" height="20" /></a> สถานที่ <input name="txt_location" type="text" id="txt_location" value="<?=$txt_location;?>" readonly="readonly" /></td>
</tr>
<tr>
<td width="2%" height="35">ผ้รับผิดชอบ</td>
<td><select name="namestaff" id="namestaff">
<option value=""><-- เลือกผู้รับผิดชอบโครงการ --></option>
<?
$strSQL = "SELECT id, name FROM tbl_staff ORDER BY id ASC ";
$objQuery = mysql_query($strSQL);
while($objResuut = mysql_fetch_array($objQuery))
{
?>
<option value="<?=$objResuut["id"];?>"><?=$objResuut["id"]." - ".$objResuut["name"];?></option>
<?
}
?>
</select></td>
</tr>
<tr>
<td width="2%" height="35">วันที่เปิดโครงการ</td>
<td><input type="text" name="start_date" id="start_date" value=""> วันที่ปิดโครงการ <input name="end_date" type="text" id="end_date" value=""></td>
</tr>
<tr>
<td width="2%" height="98" >รายละเอียด</td>
<td><textarea name="remark" id="remark" cols="50" rows="5" >บันทึกรายละเอียดที่เกี่ยวข้อง</textarea></td>
</tr>
<tr>
<td width="10%" height="35"></td>
<td width="10%" height="35"><input type="submit" name="submit_step_2" id="submit_step_2"/> <input type="reset" name="reset" id="reset" /></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
</form>
<div id="main">
</div>
<!-- // #main -->
<div class="clear"></div>
</div>
<!-- // #container -->
</div>
<!-- // #containerHolder -->
<p id="footer">Copyright © 2013 || <a href="http://www.dtvthai.com"> www.dtvthai.com</a></p>
</div>
<!-- // #wrapper -->
</body>
</html>
รบกวนผู้เชี่ยวชาญดูให้หน่อยนะคะ มันมีจุดผิดอยู่หลายจุดมาก แต่เป็นคนไม่เก่งโค้ดด้านนี้เลย ก็เลยหาตรงจุดแก้ไม่ได้
หลัก ๆคือปฏิทินไม่ขึ้นแสดงผลคะ ทำเป็นแบบ javascript แล้วก็ ข้อมูลไม่เข้า database
ขอบพระคุณคะ
Tag : PHP, MySQL
|
|
|
|
|
|
Date :
2013-08-02 11:08:02 |
By :
zion_vodka |
View :
777 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|