<?php
echo '<h1>Message area</h1>';
echo '<form action="message.php" method="GET ">';
echo 'Username:<input type="text" name="username" /><br />';
echo 'Message:<textarea name="content"></textarea><br />';
echo '<input type="submit" value= "Confirm" />';
echo '</form>';
##?>
Why can’t I receive the $username and $content variables in the form?
嘿哈2018-08-21 17:30:10
I took your code and tested it locally. I can receive the parameters. I will test step by step to see where the problem is.
vec2018-08-21 10:00:15
<?phpecho '<h1>留言区</h1>';echo '<form method="GET">';echo '用户名:<input type="text" name="username" /><br />';echo '留言:<textarea name="content"></textarea><br />';echo '<input type="submit" value="确认" />';echo '</form>';$username=isset($_GET['username']);$content=isset($_GET['content']);$file=fopen('message.txt','a');$w_content="$username : $content";fwrite($file,$w_content);//fclose($file);echo file_get_contents('message.txt');?>建议在传值的时候加上isset方法
vec2018-08-21 09:54:37
No problem with passing value. I tested it locally but the echo data should be wrong