下面的文件没有提交,而所有表单元素都是sumbited, 在下面的代码中找到错误
<form enctype = "multipart/form-data" action="tyo.php" method="POST" target="_BLANK"><?php
echo "
<input type='hidden' name='File_no' value='$emp_no'/>
<input type='hidden' name='date' value='$date'/>
<input type='hidden' name='day' value='$day'/>
<input type='hidden' name='record_id' value='$record_id' />
<input type='hidden' name='method' value='add_absence' />
";
echo "<td style='text-align:center'>
<select name='ab_ex'> ";
$sql_absence = "SELECT * FROM `ex_ab_types`";
$result_absence = $mysqli->query($sql_absence);
if ($result_absence->num_rows > 0)
{ while($row_sql_absence = $result_absence->fetch_assoc())
{
echo "<option value='$row_sql_absence[EX_ID]'>$row_sql_absence[DESC]</option>";
}
}
else
{
}
echo"<select>";
echo "</td>";
echo "<td >";?>
<input type="file" name="attac" value='' />
<?php echo "</td>";
echo "<td style='text-align:center'>
<input type='submit' style='margin-bottom: 0px;' value='save' class='btn btn-primary' />
</td>"; // submit
echo "</form>";
任何身体帮助我 ???
答案 0 :(得分:0)
我不确定为什么你的代码无效... ..但是你可以尝试下面这个表格。我已经采取了你的形式并删除了所有的PHP。这应该仍然会将文件提交到tyo.php
..
<form enctype="multipart/form-data" action="tyo.php" method="post">
<input type='hidden' name='test' value='123'/>
<input type="file" name="attac" value='' />
<input type='submit' name='submit' value='save' />
</form>
您的代码.. ..有点
<form enctype = "multipart/form-data" action="tyo.php" method="POST">
<input type='hidden' name='File_no' value='<?= $emp_no ?>'/>
<input type='hidden' name='date' value='<?= $date ?>'/>
<input type='hidden' name='day' value='<?= $day ?>'/>
<input type='hidden' name='record_id' value='<?= $record_id ?>' />
<input type='hidden' name='method' value='<?= $add_absence ?>' />
<td style='text-align:center'>
<select name='ab_ex'>
<?php
$sql_absence = "SELECT * FROM `ex_ab_types`";
$result_absence = $mysqli->query($sql_absence);
if ($result_absence->num_rows > 0){
while($row_sql_absence = $result_absence->fetch_assoc()){
echo "<option value='$row_sql_absence[EX_ID]'>$row_sql_absence[DESC]</option>";
}
}
?><select>
</td>
<td>
<input type="file" name="attac" value='' />
</td>
<td style='text-align:center'>
<input type='submit' style='margin-bottom: 0px;' value='save' class='btn btn-primary' />
</td>
</form>