我有一个页面,上面有两个表格。这应该不是问题,但它不起作用。我的 jquery 看起来像这样:
$(document).ready(function()
{
$("table.jobs tbody tr td#ejob").click(function()
{
var $this = $(this);
var col = $this.text();
var LeftCellText = $this.prev().text();
$('#jobid').val(LeftCellText);
if (col == '')
alert("Please pick another column");
else
$('#jobUpdate').submit();
});
var now = new Date();
var month = now.getMonth()+1;
var day = now.getDate();
var year = now.getFullYear();
if (month<10){month='0'+month}
if (day<10){day='0'+day}
var now = month +"/"+ day + "/" + year;
var calendarBox = $('#calDate');
//$('#calDate').val(calendarBox.datetimepicker('getDate'));
var thisone = $('#calDate').val(calendarBox.datetimepicker('getDate'));
calendarBox.datepicker(
{
minDate:('setDate', '' , new Date()),
defalt:calendarBox.val(now),
onSelect: function (selectedDateTime)
{
$('#calDate').val(calendarBox.datetimepicker('getDate'));
alert("Sendeing " + $('#calDate').val(calendarBox.datetimepicker('getDate')));
$('#calendarForm').submit();
}
});
}
);
我的表格如下所示:
echo "<form id='calendarForm' action='view_rev8.php' method='POST'>";
echo "<table border='0' width='100%'class='calendarTable'>";
echo "<tr><td align='left'>Click on a job number to update or change job information</td>";
echo "<td align='right'></td>";
echo '<td align="right">Calendar: <input type="text" id="calDate" size="15" name"calDate"/></td></tr>';
echo "</table>";
echo "</form>";
//creates the form to post jobid for updateJobForm.php
echo'<form id="jobUpdate" action="../forms/updateJobForm.php" method="post">';
echo'<input type="hidden" name="jobid" id="jobid">';
echo '</form>';
第一个函数处理用户单击表项并毫无问题地提交 post 值的情况。日期选择器工作并且表单被提交,但我收到以下错误:未定义索引:来自以下页面的 calDate:
$pickedDate = $_POST['calDate'];
include_once("../php/job_class.php");
echo $pickedDate;
$obj=new jobs();
echo "<div style='border:solid 1px '>";
foreach ($obj as $val)
{
echo "<pre>";
echo print_r($obj);
//echo $obj->jobInfo();
echo "</pre>";
echo "</div>";
}
为什么这不起作用?这是一个定义明确的表单的简单帖子,据我所知,所有字段的命名都是一致且准确的。