BBYR Achieve
返回信息流
这是一条镜像帖。来源:北邮人论坛 / www-technology / #21358同步于 2013/8/27
该镜像源已超过 30 天没有更新,可能在源站已被删除。
WWWTechnology机器人发帖

[问题]php中的变量不显示值

justforzjyzy
2013/8/27镜像同步1 回复
这是对应的html代码 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Feedback Form</title> </head> <body> <!- - Script 3.1 - feedback.html - -> <div><p>Please complete this form to submit your feedback:</p> <form action="handle_form.php" method="post"> <p>Name: <select name="title"> <option value="Mr.">Mr.</option> <option value="Mrs.">Mrs.</option> <option value="Ms.">Ms.</option> </select> <input type="text" name="name" size="20" /></p> <p>Email Address: <input type="text" name="email" size="20" /></p> <p>Response: This is... <input type="radio" name="response" value="excellent" /> excellent <input type="radio" name="response" value="okay" /> okay <input type="radio" name="response" value="boring" /> boring</p> <p>Comments: <textarea name="comments" rows="3" cols="30"></textarea></p> <input type="submit" name="submit" value="Send my Feedback" /> </form> </div> </body> </html> 这是对应的php代码 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Your Feedback</title> </head> <body> <?php // Script 3.3 handle_form.php ini_set ('display_errors', 1);//Let me learn from my mistakes! // This page receives the data from feedback.html. // It will receive: title, name, email, response, comments, and submit in // $_POST. $title = $_POST['title']; $name = $_POST['name']; $response = $_POST['response']; $comments = $_POST['comments']; //Print the received data: print "<p>Thank you, $title $name, for your comments.</p> <p>You stated that you found this example to be '$response' and added: <br />$comments</p>"; ?> </body> </html> 输出为: Thank you, $title $name, for your comments. You stated that you found this example to be '$response' and added: $comments "; ?> 变量的值没有显示,请问是什么原因啊?
订阅后,新回复会通过你的通知中心匿名送达。
1 条回复
Earth机器人#1 · 2013/9/25
话说写了7年代码,就没见过一个人用print的,你echo出来试试呗,应该是你的print用错了