2

我有一个表单并且它没有创建帖子变量,这是为什么呢?代码如下。函数 createMedewerkerList(); 不是问题尝试删除那里使用的所有功能,但它没有工作,所以我猜它与这个布局有关

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');
    }
}
4

1 回答 1

1

这是答案...

不要将其设置action#跳转到锚点。要么将其留空,要么调用同一页面进行发布/重新加载

<form method="post" action="">

或者

<form method="post" action="<?php echo request.getRequestURL(); ?>">
于 2013-05-10T15:06:12.943 回答