I just started learning PHP. I searched a lot online but I can’t use the $_post function to print out the form data
This is the code
HTML part
<code><html> <head> <title>php test</title> <meta charset=utf-8> <body > <form action="01.php"method="post"name="form1" > <table> <tr> <td>fs</td> <td><input name="fs"type="text"></td> <td><input type="submit"value="提交"></td> </tr> </table> </form> </body> </head> </html> PHP部分 <?php $fs=$_post['fs']; echo $fs; ?> 按提交按钮后只能打印出php的代码</code>
I just started learning PHP. I searched a lot online but I can’t use the $_post function to print out the form data
This is the code
HTML part
<code><html> <head> <title>php test</title> <meta charset=utf-8> <body > <form action="01.php"method="post"name="form1" > <table> <tr> <td>fs</td> <td><input name="fs"type="text"></td> <td><input type="submit"value="提交"></td> </tr> </table> </form> </body> </head> </html> PHP部分 <?php $fs=$_post['fs']; echo $fs; ?> 按提交按钮后只能打印出php的代码</code>
Make sure the formaction
path is correct
php
’s POST
receives a writing error. It needs to be capitalized $_POST['fs']
. Your lowercase method will be parsed into a variable
$_POST
Capital letters.
PHP variables are case-sensitive. Methods, function names and constants are not distinguished (but they are still required to be consistent). They need to be capitalized as the friend above said, use $_POST[], and you said you can print out php Code, I think it shouldn’t be possible.