我需要把echo作爲if語句的條件。因此,舉例來說:PHP:回聲作爲條件是否statament?
<html>
...
...
<body>
<form onsubmit"<?php $c=false; if(echo "<script>example();</script>";){ $c=true; } echo "\""; if($c){ echo "action=\"./\"";} method="post">
...
</form>
...
...
<script>
function example()
{
alert("This is only an example");
if(..) return true;
return false;
}
</script>
</body>
</html>
所以我需要在JavaScript中創建一個函數(這個頂部是僅的例子,但是,在房地產,它更復雜),並調用它的if語句。
更新 只有當Javascript函數爲true時,代碼才應該執行表單的「動作」。
你要調用JS在服務器端?不可能。 http://stackoverflow.com/q/13840429 – Teemu
對於什麼時候應該發生更具體的。現在,你的榜樣沒有多大意義。 – RST
對不起,這是什麼意思? – Sav