<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
<h2>Name: </h2><input type="text" name="name"><br>
E-mail: <input type="text" name="email"><br>
<input type="submit">
</form>
Welcome <?php echo $_POST["name"]; ?><br>
Your email address is: <?php echo $_POST["email"]; ?>
</body>
</html>
后记:
如果php代码和html需要在同一个页面上 ,文件名后缀要为php
输入待html标签的字符方法:
echo '<p style="font-family:times;color:red">调整后显示百分比== '.$surpass.'%</p>';