【发布时间】:2014-08-07 22:55:33
【问题描述】:
<html>
<head>
<title> </title>
<script type="text/javascript">
var datefield=document.createElement("input");
datefield.setAttribute("type", "date");
if (datefield.type!="date"){ //if browser doesn't support input type="date", load
files for jQuery UI Date Picker
document.write('<link type="text/css" href="scripts/jquery-ui.css" rel="stylesheet"
/>\n');
document.write('<script src="scripts/jquery.min.js"><\/script>\n');
document.write('<script src="scripts/jquery-ui.min.js"><\/script>\n');
}
</script>
<script>
if (datefield.type!="date"){ //if browser doesn't support input type="date",
initialize date picker widget:
jQuery(function($){ //on document.ready
$('#date').datepicker();
});
}
</script>
<style type="text/css">
body{
margin-left: 10%;
margin-right: 10%;
font-family: sans-serif;
}
</style>
</head>
<body>
<h1 align="center">Date Sheet Feed </h1>
<form name="frm" method="post" action='<?php echo $_SERVER['PHP_SELF']; ?>'>
<table width="50%" border="1" cellpadding="3" cellspacing="3" align="center">
<?php
$value1=array();
$select_query="SELECT Distinct branch FROM department";
$result=mysqli_query($dbcon,$select_query);
if(!$result) die("Fail".mysqli_error($dbcon));
while($row=mysqli_fetch_array($result))
{
$value1[]=$row['branch'];
}
?>
<tr><td>Branch<td><select name="branch" id="branch" onchange="document.frm.submit();">
<option >Select Branch</option>
<?php
foreach($value1 as $gets)
{
?>
<option value='<?php echo $gets;?>' <?php
if(true===isset($_POST['branch']))
{
print($gets==$_POST['branch'] ? ' selected="selected"' :
'');
} ?> > <?php echo $gets; ?></option>
<?php
}
?>
</select></td></tr>
我想使用下拉列表中的选项提交表单。但表格没有被提交。请帮帮我
【问题讨论】:
-
我浏览了您的代码,但没有找到结束
</form>标记。 -
您需要附加jquery更改功能以在下拉值.change上提交您的表单
-
存在于主代码中
标签: javascript php jquery html forms