我有一个表单而不是创建帖子变量, 为什么是这样?代码如下。 函数createMedewerkerList();不是问题 尝试删除那里使用的所有功能,但它没有工作,所以我geuss它与这个布局有关
function writeHoursForm(){
echo '<form method="post" action="#">';
echo '<div class="topWrapper">'; // open topwrapper
echo '<div class="employeeData">'; // open employeedata
echo '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
echo '<tr>';
echo '<td>Werknemer</td>';
echo '<td>';
if (permissiesUren(0,0,1,false)){
echo '<div class="ui-widget">';
echo createMedewerkerList();
echo '</div>';
}else{
echo $_SESSION['name'];
echo '<input name="medewerkerid" type="hidden" value="'.$_SESSION['id'].'">';
}
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<td>Weeknummer</td>';
echo '<td><input name="week" type="text" value="'.$date1.'"></td>';
echo '</tr>';
echo '<tr>';
echo '<td>Jaar</td>';
echo '<td><input name="jaar" type="text" value="'.$date2.'"></td>';
echo '</tr>';
echo '</table>';
echo '</div>'; // close omployeedata
echo '</div>'; // close topwrapper
echo '<div class="urenBriefWrap">'; // open urenbriefwrap
echo '<div class="urenBrief">'; // open urenbrief
echo '<table width="100%" border="0" cellspacing="0" cellpadding="0">';
echo '<tr>';
echo '<th>Projectnummer</th>';
echo '<th>Omschrijving</th>';
echo '<th>Uren<br>100%</th>';
echo '<th>Uren<br>125% </th>';
echo '<th>Uren<br>150% </th>';
echo '<th>Kilometers<br>auto zaak</th>';
echo '<th>Kilometers<br>auto prive</th>';
echo '<th>Reisuren</th>';
echo '</tr>';
echo '<tr>';
echo '<td width="139"><input name="projectnummer" type="text"></td>';
echo '<td width="358">geen data beschikbaar</td>';
echo '<td width="68"><input name="uren_100" type="text"></td>';
echo '<td width="68"><input name="uren_125" type="text"></td>';
echo '<td width="68"><input name="uren_150" type="text"></td>';
echo '<td width="91"><input name="kilometers_zaak" type="text"></td>';
echo '<td width="91"><input name="kilometers" type="text"></td>';
echo '<td width="83"><input name="reisuren" type="text"></td>';
echo '</tr>';
echo '</table>';
echo '</div>'; // close urenbrief
echo '</div>'; // close topwrapper
echo '<input class="submit" type="submit" name="submit" value="Verzenden">';
echo '<input class="submit" type="submit" name="submit" value="Verzenden & nieuwe regel toevoegen">';
if (permissiesUren(0,0,1,false)){
echo '<input class="submit" type="submit" name="submit" value="Verzenden zonder tussencontrole">';
}
echo '</form>';
}
处理此表单的函数:
function urenRegisterParser(){
if ($_SERVER['REQUEST_METHOD'] != 'POST'){
writeHoursForm();
}
else if($_POST['submit'] == 'Verzenden & nieuwe regel toevoegen'){
writeHoursToDB(false, $_POST);
header('location: '.fullUrl().'urenregistratie/uren_invullen/?send=done');
}
else if($_POST['submit'] == 'Verzenden'){
$NaamId = writeHoursToDB(false, $_POST);
header('location: '.fullUrl().'urenregistratie/medewerkers/?NaamId='.$NaamId);
}
else if($_POST['submit'] == 'Verzenden zonder tussencontrole'){
writeHoursToDB(true, $_POST);
header('location: '.fullUrl().'urenregistratie/uren_invullen/?send=done');
}
}
答案 0 :(得分:1)
这是答案......
不要将action
设置为#
所有操作都会跳转到某个锚..要么将其留空或调用同一页面发布/重新加载
<form method="post" action="">
或
<form method="post" action="<?php echo request.getRequestURL(); ?>">