我在使用php中的submit按鈕來進行一些簡單的操作。這是我要運行的代碼(它是一個網站,你打分的事情,如果這能幫助任何):在php中POST和提交按鈕的麻煩
<form method="POST">
<input type="radio" name="person" value="1" />
<input type="radio" name="person" value="2" />
<input type="submit" name="submit" />
</form>
<?php;
$_variable1 = 1400
function ratePerson($person)
{
$_variable1+1
echo $_variable1
}
if (isset($_POST['submit']));
{
$person = $_post['person'];
echo $person;
ratePerson($person)
}
echo $_variable1
?>
所以,當我運行這個提交按鈕和兩個單選按鈕出現,我可以點擊一個他們並點擊提交,只是當我點擊一個按鈕並點擊提交時,沒有任何反應,沒有打印的值(回聲),我不知道+1是否工作,這是一團糟。我沒有在php中做過很多,所以請原諒我的無知。
我從朋友那裏得到了這段代碼,所以如果你想建議你自己的解決方案,那麼就去吧。
感謝您的幫助!
我想你想''_variable1 + = 1',而不是'$ _variable1 + 1' – Jerfov2
可能是因爲PHP代碼在合成上是不正確的。看看你rerror日誌或添加[錯誤報告](http://stackoverflow.com/questions/845021/how-to-get-useful-error-messages-in-php/845025#845025)到您的頂部 file(s)_while testing_正好在您打開PHP標記後,例如 '<?php error_reporting(E_ALL); ini_set('display_errors',1);' – RiggsFolly
這很瞭解,但它仍然不會打印下一頁上的值。 – SamtheMan