ローカル環境で確認した際にPHP動作で以下のエラーメッセージがでました。
Array ( [difficulty] => 2 )
Warning: Undefined array key "recipe_name" in C:\MAMP\htdocs\yasashiiphp\receive.php on line 3
Deprecated: htmlspecialchars(): Passing null to parameter #1 ($string) of type string is deprecated in C:\MAMP\htdocs\yasashiiphp\receive.php on line 3
以前も同じような質問をさせていただいておりましたが、ローカルでの環境構築ができていないのでしょうか?
ご教授いただければ幸いです。
前質問→https://teratail.com/questions/fq35ke033ywad7
以前の質問での回答・補足としてご回答いただいたでPHP動作環境の確認にて
「recieve.php」で「echo 'test';」→test表示はされました.
以下ソースコードです。
form.html
<html lang="ja"> <head> <meta charset="UTF-8"> <title>入力フォーム</title> </head> <body> 入力フォーム<br> <form method="post" action="receive.php"> 料理名:<input type="text" neme="recipe_neme" required><br> カテゴリー: <select neme="category"> <option hidden>選択してください</option> <option value="1">和食</option> <option value="2">中華</option> <option value="3">洋食</option> </select> <br> 難易度: <input type="radio" name="difficulty" value="1">簡単 <input type="radio" name="difficulty" value="2" checked>普通 <input type="radio" name="difficulty" value="3">難しい <br> 予算:<input type="number" min="1" max="9999" neme="budget">円 <br> 作り方: <textarea neme="howto" cols="40" rows="4" maxlength="320"> </textarea> <br> <input type="submit" value="送信"> </form> </body> </html>
recieve.php
print_r($_POST); echo htmlspecialchars($_POST['recipe_name'], ENT_QUOTES); ?>
OS環境 Windows 11 Home
ローカルサーバー MAMP
ブラウザ グーグルクロム
