|
|
|
บันทึกข้อมูลลงฐานข้อมูลแล้วข้อมูลซ้ำ2 record บน IE |
|
|
|
|
|
|
|
ผมเคยเป็นน่ะครับแล้ว Browser อื่นเป็นไหมครับ ลองเอาโค๊ดมาวางหน่อยสิครับพี่ๆในนี้จะได้ช่วยกันดูครับ
|
|
|
|
|
Date :
2013-08-01 10:03:39 |
By :
thitikub |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
บนchrome ไม่เป็นค่ะ ลองดูโค้ดนะคะ
Add.php
Code (PHP)
<html xmlns="http://www.w3.org/1999/xhtml"><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Add Data</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script>
$(function() {
$( "#datepicker" ).datepicker();
$( "#datepicker2" ).datepicker();
$( "#datepicker3" ).datepicker();
});
</script>
</head>
<body>
<center> Add Data </center><br>
<script language="javascript">
function fncSubmit()
{
if(document.form1.appid.value == "")
{
alert('Please input App id');
document.form1.appid.focus();
return false;
}
if(document.form1.appname.value == "")
{
alert('Please input App name');
document.form1.appname.focus();
return false;
}
if(document.form1.datepicker.value == "")
{
alert('Please input Deploy date');
document.form1.datepicker.focus();
return false;
}
if(document.form1.timepicker.value == "")
{
alert('Please input Deploy time');
document.form1.timepicker.focus();
return false;
}
if(document.form1.datepicker2.value == "")
{
alert('Please input Running date');
document.form1.datepicker2.focus();
return false;
}
if(document.form1.timepicker1.value == "")
{
alert('Please input Running time');
document.form1.timepicker1.focus();
return false;
}
if(document.form1.datepicker3.value == "")
{
alert('Please input Actaul running date');
document.form1.datepicker3.focus();
return false;
}
if(document.form1.timepicker2.value == "")
{
alert('Please input Actaul running time');
document.form1.timepicker2.focus();
return false;
}
if(document.form1.preappcode.value == "")
{
alert('Please input Pre app code');
document.form1.preappcode.focus();
return false;
}
if(document.form1.postappcode.value == "")
{
alert('Please input Post app code');
document.form1.postappcode.focus();
return false;
}
if(document.form1.ownername.value == "")
{
alert('Please input Owner name');
document.form1.ownername.focus();
return false;
}
if(document.form1.ownerfunction.value == "")
{
alert('Please input Owner function');
document.form1.ownerfunction.focus();
return false;
}
if(document.form1.ownerphoneno.value == "")
{
alert('Please input Owner phone no');
document.form1.ownerphoneno.focus();
return false;
}
document.form1.submit();
}
</script>
<form name ="form1" id="form1" action="savetestadd.php" method="post" class="ui-corner-left" onSubmit="JavaScript:return fncSubmit();">
<table border="1" align="center" bgcolor="#CCCCCC">
<tr>
<td>APP ID :</td>
<td><input type="text" name="appid" id="appid" style="width : 100%;height : 20px;"/></td>
</tr>
<tr>
<td>APP Name :</td>
<td><input type="text" name="appname" id="appname" style="width : 100%;height : 20px;"/></td>
</tr>
<tr>
<td>Deploy date :</td>
<td>
<p>Date: <input type="text" id="datepicker" name="datepicker"/></p>
</td>
</tr>
<tr>
<td>Deploy time :</td>
<td> <input type="text" id="timepicker" name="timepicker"/></td>
</tr>
<tr>
<td>Running date :</td>
<td>
<p>Date: <input type="text" id="datepicker2" name="datepicker2" /></p>
</td>
</tr>
<tr>
<td>Running time :</td>
<td> <input type="text" id="timepicker1" name="timepicker1"/></td>
</tr>
<tr>
<td>Actaul running date :</td>
<td>
<p>Date: <input type="text" id="datepicker3" name="datepicker3"/></p>
</td>
</tr>
<tr>
<td>Actaul running time :</td>
<td> <input type="text" id="timepicker2" name="timepicker2"/></td>
</tr>
<tr>
<td>Pre app code :</td>
<td><input type="text" name="preappcode" id="preappcode" style="width : 100%;height : 20px;"/></td>
</tr>
<tr>
<td>Post app code :</td>
<td><input type="text" name="postappcode" id="postappcode" style="width : 100%;height : 20px;"/></td>
</tr>
<tr>
<td>Owner name :</td>
<td><input type="text" name="ownername" id="ownername" style="width : 100%;height : 20px;"/></td>
</tr>
<tr>
<td>Owner function :</td>
<td><input type="text" name="ownerfunction" id="ownerfunction" style="width : 100%;height : 20px;"/></td>
</tr>
<tr>
<td>Owner phone no :</td>
<td><input type="text" name="ownerphoneno" id="ownerphoneno" style="width : 100%;height : 20px;"/></td>
</tr>
</table>
<br>
<center><input type="submit" name="add" id="add" value="Add" />
<input type="button" name="select" id="select" value="Select Data" onClick="javascript:window.location.href='testselect.php';" />
</center>
</form>
</body>
</html>
savetestadd.php
Code (PHP)
<style type="text/css">
body
{
background-image:
url(image/bg.gif);
background-repeat : no-repeat;
}
</style>
<body>
<?php
include('config.php');
$appid=$_POST['appid'];
$appname=$_POST['appname'];
$deploydate=$_POST['datepicker'];
$deploytime=$_POST['timepicker'];
$runningdate=$_POST['datepicker2'];
$runningtime=$_POST['timepicker1'];
$Arunningdate=$_POST['datepicker3'];
$Arunningtime=$_POST['timepicker2'];
$preappcode=$_POST['preappcode'];
$postappcode=$_POST['postappcode'];
$ownername=$_POST['ownername'];
$ownerfunction=$_POST['ownerfunction'];
$ownerphoneno=$_POST['ownerphoneno'];
$strSQL = "INSERT INTO mainapp";
$strSQL .="(APP_ID,APP_NAME,DEPLOY_DATE,DEPLOY_TIME,RUNNING_DATE,RUNNING_TIME
,ACTUAL_RUNNING_DATE,ACTUAL_RUNNING_TIME,PRE_APP_CODE,POST_APP_CODE,OWNER_NAME,OWNER_FUNCTION,OWNER_PHONE_NO)";
$strSQL .="VALUES";
$strSQL .="('".$appid."', '".$appname."', '".$deploydate."','".$deploytime."','".$runningdate."','".$runningtime."','".$Arunningdate."','".$Arunningtime."','".$preappcode."', '".$postappcode."', '".$ownername."', '".$ownerfunction."', '".$ownerphoneno."')";
$objQuery = mysql_query($strSQL);
if($objQuery)
{
echo "<script>alert('Add Data Complet');window.location='Add.php';</script>";
}
else
{
echo "<font color=red>**</font> Can not add data";
}
?>
</body>
ช่วยดูด้วยนะคะ ขอบคุณค่ะ
|
ประวัติการแก้ไข 2013-08-01 11:12:33
|
|
|
|
Date :
2013-08-01 10:12:33 |
By :
kotchakorn_j |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ไม่มีคนตองไม่เป็นไรค่ะ แก้ได้แล้วค่ะ ตรง document.form.submit();นี่เอง ต้องขอบคุณ กระทู้ที่เกี่ยวข้องในthaicreateและ คุณ thitikub ด้วยค่ะ
|
ประวัติการแก้ไข 2013-08-01 15:27:04
|
|
|
|
Date :
2013-08-01 13:34:31 |
By :
kotchakorn_j |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|