我有一個收集學生信息的表格,其簡單版本在這里:<form method="post" name="submit" action="submit" autocomplete="off"> <br><input type="name" id="forename" name="forename" placeholder="Forename" required> <br><input type="name" id="middlename" name="middlename" placeholder="Middle Name/s" required> <br><input type="name" id="surname" name="surname" placeholder="Surname" required> <br><input type="tel" id="mobile" name="mobile" placeholder="Mobile Number (+44)" required> <br><input type="email" id="email" name="email" placeholder="Email" required> <br><input type="message" id="course" name="course" placeholder="Course You're Studying" required> <br><input type="message" id="code" name="code" placeholder="Course Code" required> <br><input type="message" id="campus" name="campus" placeholder="Campus" required> <br><input type="message" id="message" name="message" placeholder="Comments"> <br><br><input type="file" title="Attach your ID" id="studentidentification" name="studentidentification" required> <br><input type="file" title="Attach personal ID" id="personalidentification" name="personaldentification" required> <br><br><input type="submit" name="submit" id="submit" value="Submit" required="">然后將該表格發送至submit.php例如。(該頁面有一個隨機 URL,然后將用戶發送到一個新頁面)接下來的 PHP 獲取所有用戶輸入并將其寫入 CSV,其中包括學生的文件名和個人身份信息以供交叉引用。PHP 還應該上傳文件夾內文件夾中的每個文件responses。所以csv,student和personal.由于某種原因,輸出了未知錯誤,我覺得這與兩個文件上傳到同一個文件中這一事實有關。兩個 ID 必須單獨填寫并在同一表格內。我希望我能得到報酬來解決這個問題,但我不知道從這里該去哪里,因為即使 CSV 也不會寫入,而這是基于有效的代碼。當目錄實際存在時,error_log已生成的Apache會拋出Undefined index大多數錯誤。failed to open stream: No such file or directory還有fwrite() expects parameter 1 to be resource, boolean given和fclose() expects parameter 1 to be resource, boolean。詢問是最后的手段,因為理論上這應該有效,如果由于某種原因這是一個明顯的錯誤,那么很抱歉。任何幫助將不勝感激。謝謝 :)
1 回答

qq_花開花謝_0
TA貢獻1835條經驗 獲得超7個贊
有2個問題:
您需要在 URL 開頭 使用
./
代替,以便您的 URL 是相對的并且不會引用您網站的基礎。這將修復該錯誤。/
failed to open stream: No such file or directory
如果您想發送文件,您需要
enctype="multipart/form-data"
在表單中添加:<form method="post" name="submit" action="submit" autocomplete="off" enctype="multipart/form-data"> ... </form>
這將修復該
Undefined index: studentidentification in /home/hosting/domains/example.com/public_html/onboarding/forms/collectid/submit.php
錯誤。
另外,請確保您已在php.ini
file_uploads
(PHP 配置)文件中進行設置。on
- 1 回答
- 0 關注
- 96 瀏覽
添加回答
舉報
0/150
提交
取消