我被困在試圖使這項工作,我有一個HTML表單,文件和文本輸入,提交後我想要通過循環處理這些輸入我的PHP腳本。目前,循環跳過文件輸入並僅處理文本輸入。我是新來的PHP,我似乎不明白什麼是錯的,以及如何解決它。這裏是表單代碼和PHP代碼來處理它。使用PHP循環處理來自HTML表單的文本和文件輸入
<form action='loop.php' enctype="multipart/form-data" data-ajax="false" method="POST">
<input type ="text" name ="Input1"/>
<input type ="file" name ="Input2"/>
<input type ="text" name ="Input3"/>
<input type ="text" name ="Input4"/>
<input type='submit' data-corners="false" value ='submit'/>
</form>
loop.php
<?php
foreach ($_POST as $key => $value){
if($_POST[Input2]) //check if its the file input
{//some manipulation on the file}
else
//process all other text inputs}
?>
感謝您的幫助
'文件'位於'$ _FILES'中,發佈的數據位於'$ _POST'中。 – Ohgodwhy
我不知道......謝謝。使用'$ _FILES'我現在可以訪問文件 –