Reputation: 631
I have a form and its not creating post variables, why is this? the code is below. The function createMedewerkerList(); is not the issue try'd removing all functions used in there but it didnt work so i geuss its something to do with this layout
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>';
}
The functions processing this 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');
}
}
Upvotes: 2
Views: 130
Reputation: 2220
here is it in an answer...
dont set the action
to #
all that does is jump to an anchor.. either leave it blank or call the same page to post/reload
<form method="post" action="">
or
<form method="post" action="<?php echo request.getRequestURL(); ?>">
Upvotes: 1