2013-11-14 23 views
-1

我用這行PHP在我的主頁回聲文本旁邊一個生成的值PHP

echo generateRadioButtons("fbresponse.php", "moRating1", 6); 

其中發佈時的響應文件以下

echo $_POST['moRating1'] 

它工作正常,並顯示正確的結果,但!我的問題是如何將我添加文字,如此..

等等等等等等,你額定X問題:「moRating1」

我試着做

<html> 
<head> 
<title>Questions</title> 
</head> 
<body> 
<h1>Survey responses</h1> 
<p>How well did you rate it : <?php print $moRating1 ?></p> 
</body> 
</html> 

響應文件內,但只是沒有加載任何東西..

請任何幫助!

回答

1

這可能是因爲此功能使用eval()來執行其內容(我想你的第一個例子中缺乏PHP標籤)。

如果這是真的,那麼你應該能夠關閉PHP標籤,打印HTML並再次打開它。

?> 
<html> 
    <head> 
     <title>Questions</title> 
    </head> 
    <body> 
     <h1>Survey responses</h1> 
     <p>How well did you rate it : <?php print $_POST['moRating1'] ?></p> 
    </body> 
</html> 
0

嘗試做:

$mRating1 = $_POST['moRating1']; 
... 
?> 
... 
<p>How well did you rate it: <?php echo $mRating1?></p>