当表单提交时我的jquery手风琴停止工作我的文件名是add.php这里是它的代码
<?php require_once('database.php');?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<link rel="stylesheet" href="css/accordionTheme.css">
<script src="js/jquery.js" type="text/javascript"></script>
<script src="js/jquery.ui.core.js" type="text/javascript"></script>
<script src="js/jquery.ui.widget.js" type="text/javascript"></script>
<script src="js/jquery.ui.accordion.js" type="text/javascript"></script>
<script>
$(function() {
$("#myAccordion").accordion();
});
</script>
<head>
<body>
<div id="myAccordion"><!-- Start Accordion --->
<h2>
<a href="#">Add Student</a>
</h2>
<div>
<form action="add.php" id="form1" method="get" >//here my form start
<p>Please add Student Data</p>
<label for="stname">Enter Student Name:</label>
<input name="stname" type="text" id="stname" size="37" />
<br /><br />
<label for="stclass">Enter Student Class :</label>
<select name="stclass">
<option>MPhil</option>
<option>M.Sc.</option>
</select>
<br />
<input name="Add" type="submit" id="Add" value="Add" />
</form>
<?php
//lets start submit data to database
if(isset($_GET['stname'])&& isset($_GET['stclass']))
{
$stname=$_GET['stname'];
$stclass=$_GET['stclass'];
if(mysql_query("insert into student(teacher_id,student_name,student_class) values ('1','$stname','$stclass')"));
{
print "<p>record added</p";
}
}
?>
</div>
<h2>
<a href="#">Add course</a>
</h2>
<div></div>
<h2>
<a href="#">Add publication</a>
</h2>
<div></div>
</body>
</html>
我在正文中打印php,您可以在提交表单时看到recordadded
。
答案 0 :(得分:4)
您使用PHP打印的p
标记未关闭,这就是让JavaScript变得疯狂的原因。关闭它,它应该工作正常。