如何根据变量安排表单提交?

时间:2013-07-10 11:09:53

标签: php forms action

<form action="<?php if($count==3) 
                        echo"populate3.php"; 
                    else
                        echo"populate1.php"; ?>" method="get" id="form1">

写这个是正确的吗? 什么可以替代?

1 个答案:

答案 0 :(得分:2)

<?php
$action="":
 if($count==3) 
 {
 $action="populate3.php";      
 }
else
{
 $action="populate1.php"; 
}

echo ("<form action=\"$action\" method=\"get\" id=\"form1\">");