Мне присваивается создание HTML-страницы, которая принимает вход пользователя, а затем проверяет ввод пользователя на php-скрипте (после нажатия кнопки "Отправить" на странице HTML). До сих пор я пытаюсь проверить первую переменную имени HTML-страницы на странице PHP.
Моя проблема в том, что страница PHP не отображает переменные HTML, "fname". Я искал хорошее решение, но я пока не могу найти ничего
Я использую Aptana Studio 3, и я запускаю XAMPP. Я разместил свой код HTML и PHP ниже для просмотра. Любая помощь будет принята с благодарностью :)
<!DOCTYPE html>
<html>
<head>
<title>
Assignment Four, HMTL/PHP Form
</title>
<meta charset = "UTF-8">
</head>
<body>
<!--Begin the body code-->
<h1>Assignment Four: HTML/PHP Form</h1>
<p>Watch the following video, write a brief review and then click submit!</p>
<!--Post the Scholartica Video-->
<iframe width="560" height="315" src="//www.youtube.com/embed/d_2_8n86jA8" frameborder="0"
allowfullscreen></iframe>
<h3>Complete the following information:</h3>
<form method = "post" action = "form.php">
<p><label>First Name</label>
<input type = "text" name = "fname"></p>
<p><label>Last Name</label>
<input type = "text" name = "lname"></p>
<p><label>Email:</label>
<input type = "text" name = "email"></p>
<p><label>Phone:</label>
<input type = "text" name = "phone"
placeholder = "(123) 456-7890"></p>
<h3>Write a brief review about the video here</h3>
<p><textarea rows = "4" cols="50" name = "review">What did you think?
</textarea></p>
<h3>Rate the quality of the video</h3>
<select name = "Rating">
<option>Poor</option>
<option>Average</option>
<option>Good</option>
<option>Excellent</option>
</select>
<p><input type = "submit" name ="submit" value ="Register"></p>
</form>
</body>
</html>
Моя PHP-форма выглядит так
<!DOCTYPE html>
<html>
<body>
Hi <?php echo $_POST["fname"];?>
Thank you for finishing the survey
Your responses have been recorded.
</body>
</html>
Я запустил код и, похоже, сработал. Введите имя = "Боб" и нажмите кнопку "Отправить" с
Привет, Боб. Спасибо, что закончили опрос. Ваши ответы были записаны.
Убедись, что: