使用一个提交按钮在许多选项卡中保存和更新记录 [英] Save and update records in many tabs with one submit button
问题描述
我在一个表单中有两个标签。在第1季度进度的选项卡-1中插入记录后,用户然后更新第2季度进度的选项卡-2中的记录,这是进度表中的同一行。但是,当我单击提交按钮或更新按钮时,不会保存或更新任何记录。以下是代码。请指教。谢谢。
<!doctype html>
< html lang =en>
< head>
< link rel =stylesheettype =text / csshref =style.css/>
< style>
div.savestatus {/ *表格顶部显示的保存表格内容DIV的样式* /
宽度:200px;
填充:2px 5px;
边框:1px纯灰色;
背景:#fff6e5;
-webkit-box-shadow: 0 0 8px#818181;
box-shadow:0 0 8px#818181;
-moz-border-radius:5px;
- webkit-border-radius:5px;
border-radius:5px;
颜色:红色;
位置:绝对值;
top:-10px;
}
表格#feedbackform div {/ *演示表单使用的CSS * /
margin-底部:9px;
}
< / style>
< script type =text / javascriptsrc =http:/ /ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js\"></script>
< scr ipt src =autosaveform.js>
/ ******************************* ****************
*自动保存表单脚本(c)动态驱动器(www.dynamicdrive.com)
*此通知必须保持完整无法合法使用
*访问http://www.dynamicdrive.com/获取此脚本以及100多个。
******* **************************************** /
< ; / script>
< script>
var formsave1 = new autosaveform({
formid:'ipdprogress',
暂停:1000 //< - 最后一个选项后没有逗号!
})
< / script>
< ; meta charset =utf-8>
< title>机构绩效数据系统数据库< / title>
< link rel =stylesheethref = //code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css\">
< script src =// code.jquery.com/jquery -1.10.2.js>< / script>
< script src =// code.jquery.com/ui/1.11.2/jquery-ui.js >< / script>
< link rel =stylesheethref =/ resources / demos / style.css>
< script>
$(function(){
$(#tabs)。tabs();
});
< / script>
< / head>
< body>
Hi, i have 2 tabs in one form. After inserting records in tabs-1 for quarter 1 progress, user then updates records in tabs-2 for quarter 2 progress, which is of the same row in the progress table. However when i click submit button or update button, no records are being saved or updated. Below are the codes. Please advise. Thanks.
<!doctype html>
<html lang="en">
<head>
<link rel="stylesheet" type="text/css" href="style.css"/>
<style>
div.savestatus{ /* Style for the "Saving Form Contents" DIV that is shown at the top of the form */
width:200px;
padding:2px 5px;
border:1px solid gray;
background:#fff6e5;
-webkit-box-shadow: 0 0 8px #818181;
box-shadow: 0 0 8px #818181;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius:5px;
color:red;
position:absolute;
top:-10px;
}
form#feedbackform div{ /*CSS used by demo form*/
margin-bottom:9px;
}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script src="autosaveform.js">
/***********************************************
* Auto Save Form script (c) Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
</script>
<script>
var formsave1=new autosaveform({
formid: 'ipdprogress',
pause: 1000 //<--no comma following last option!
})
</script>
<meta charset="utf-8">
<title>Institutional Performance Data System Database</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<script>
$(function() {
$( "#tabs" ).tabs();
});
</script>
</head>
<body>
第二部分:进展
session_start();
error_reporting(E_ALL ^ E_NOTICE);
$ _SESSION ['Userid']; //它将打印用户标识值
$ _SESSION ['Username']; //它将打印用户ID值
$ _SESSION ['Email'];
$ connection = mysql_connect(localhost,user,)或者死(数据库连接失败!
);
$ result = mysql_select_db(p)或死掉(数据库无法选择!);
$ Picid = 0;
if(isset($ _ GET ['Picid'])){
$ _SESSION ['Picid'] = $ _ GET ['Picid'] ;
$ Picid = $ _ SESSION ['Picid'];
$ query =选择Userid,来自general_ipd的Picid,其中Userid ='。$ _ SESSION ['Userid']。'和Picid ='。$ Picid。';
$ result = mysql_query($ query)或die(mysql_error());
if($ row = mysql_fetch_array($ result))
{
echo< input type ='hidden'name ='hidden'value ='。$ row ['Userid']。''>
;
echo< input type ='hidden'name ='hidden'value ='。$ Picid。'>
;
}
}
?>
SECTION II: Progress
session_start();
error_reporting(E_ALL ^ E_NOTICE);
$_SESSION['Userid']; // it will print the userid value
$_SESSION['Username']; // it will print the userid value
$_SESSION['Email'];
$connection = mysql_connect("localhost","user","") or die("Database connection failed!
");
$result=mysql_select_db("p") or die("Database could not be selected!");
$Picid=0;
if (isset($_GET['Picid'])) {
$_SESSION['Picid']=$_GET['Picid'];
$Picid=$_SESSION['Picid'];
$query="Select Userid,Picid from general_ipd where Userid='".$_SESSION['Userid']."' and Picid= '".$Picid."'";
$result=mysql_query($query)or die(mysql_error());
if($row=mysql_fetch_array($result))
{
echo "<input type='hidden' name='hidden' value='".$row['Userid']."'>
";
echo "<input type='hidden' name='hidden' value='".$Picid."'>
";
}
}
?>
1.Target
session_start();
error_reporting(E_ALL ^ E_NOTICE);
$ conn = mysql_connect(localhost,user,);
mysql_select_db( p,$ conn);
if(isset($ _ POST ['update'])){
mysql_query(UPDATE progress set Quanprogress2 ='。$ _POST [Quanprogress2]。',Qualprogress2 ='。$ _POST [Qualprogress2]。'WHERE Picid ='。$ Picid。'和Progressid ='。$ Progressid。'');
$ message =记录修改成功;
}
$ result = mysql_query(SELECT * FROM progress WHERE Picid ='。 $ Picid。'和Progressid ='。$ Progressid。');
$ row = mysql_fetch_array($ result);
?>
1.Target
< / body>
< input type =submit name =submitvalue =Submitclass =btnSubmit> |
< input type =submitname =updatevalue =Updateclass =btnSubmit> |
< / form>< / html>
</body>
<input type="submit" name="submit" value="Submit" class="btnSubmit"> |
<input type="submit" name="update" value="Update" class="btnSubmit"> |
</form></html>
推荐答案
(function(){
(function() {
(#tabs)。tabs();
});
< / script>
< / head>
< body>
( "#tabs" ).tabs();
});
</script>
</head>
<body>
第二部分:进度
session_start();
error_reporting(E_ALL ^ E_NOTICE);
SECTION II: Progress
session_start();
error_reporting(E_ALL ^ E_NOTICE);
_SESSION ['Userid']; //它将打印用户标识值
_SESSION['Userid']; // it will print the userid value
这篇关于使用一个提交按钮在许多选项卡中保存和更新记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!