[英]PHP code is converted as comments in browser and $_REQUEST is not displaying any data?
I have created two simple web pages, one is written in HTML, and the second is written in PHP. 我已经创建了两个简单的网页,一个用HTML编写,第二个用PHP编写。 In the HTML page, I include form tag with action attribute and its attribute value is index.php(second page) and index.php(second page) include $_REQUEST but no value is displayed.
在HTML页面中,我包含带有动作属性的表单标记,其属性值是index.php(第二页),而index.php(第二页)包括$ _REQUEST,但不显示任何值。
html page HTML页面
<html>
<head>
<title>testing of php</title>
</head>
<body>
<h3>here the value will be displayed</h3>
<form method="post" action="index.php">
please enter your name:
<input type="text" name="don"></input><br>
<input type="button" value="send"></input>
</form></body>
</html>
php page php页面
<html>
<head>
<title>testing of php</title>
</head>
<body>
<?php
echo "hello:";
echo $_REQUEST['don'];
?>
</body>
</html>
该类型应submit
不button
使用POST方法提交表单:
<input type="submit" value="send"></input>
You need to make another input type. 您需要输入其他输入类型。 Working code:
工作代码:
HTML 的HTML
<html>
<head>
<title>testing of php</title>
</head>
<body>
<h3>here the value will be displayed</h3>
<form method="post" action="index.php">
please enter your name:
<input type="text" name="don"></input><br>
<input type="submit" value="send"></input>
</form></body>
</html>
PHP 的PHP
<html>
<head>
<title>testing of php</title>
</head>
<body>
<?php
echo "hello:";
echo $_REQUEST['don'];
?>
</body>
</html>
https://www.w3schools.com/html/html_form_input_types.asp https://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_submit https://www.w3schools.com/html/html_form_input_types.asp https://www.w3schools.com/html/tryit.asp?filename=tryhtml_form_submit
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.