我不明白,我想在提交表单后查看变量的值。相同的页面处理程序
echo $description, $class, $audio, $answer, $tonality ;
但都无济于事,到头来完全糊涂了。帮助。
<form action="add_material.php" method="post" enctype="multipart/form-data" id="myform"></form>
<!-- кусок таблицы -->
<tr>
<td><input type="textarea" name="description" form="myform"></td>
<td><input type="text" name="class" form="myform"></td>
<td>
Аудио (строго mp3)<br>
<input name="userfile[]" type="file" form="myform"><br><br>
Ответ (строго png)<br>
<input name="userfile[]" type="file" form="myform"><br>
</td>
<td><select required size = "1" name = "tonality" form="myform">
<option disabled>Тональность</option>
<option value = "C-dur_nastroi.mp3">C-Dur</option>
<option value = "d-moll_nastroi.mp3">d-moll</option>
</select></td>
<td><input type="submit" name="add" form="myform"/> </td>
</tr>
<?php
if ( isset( $_POST['description'] ) and isset( $_POST['class'] ) and isset( $_POST['userfile[0]'] ) and isset( $_POST['userfile[1]'] ) and isset( $_POST['tonality'] )) {
$description = $_POST['description'];
$class = $_POST['class'];
$audio = $_POST['userfile[0]'];
$answer = $_POST['userfile[1]'];
$tonality = $_POST['tonality'];
echo $description, $class, $audio, $answer, $tonality ;
}
?>
因为文件到达全局数组$_FILES,而不是
$_POST
同时,它甚至不会
但像这样
具体来说,数组打印输出
$_FILES['userfile']
将如下所示:从这里开始,您的条件未满足,因此它不会打印任何内容。
对于未来:学习基础知识并学习一些不错的函数,例如var_dump和print_r以了解发生了什么
至少应在所有输入结束后关闭表单标签 =)