我需要把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