<form action='a.php?act=XXX' method='post'>
<input type='text' name='action' value=''/>
<input type='submit' name='sub' value='提交'/>
</form>此段代码form表单中的action属性中XXX是获取到的<input type='text' name='action' value=''/>框中的值,
请问我该怎么获取到,谢谢

解决方案 »

  1.   

    你form的action里面直接写a.php就可以了啊,这样就能接收到所有表单中的值
      

  2.   

    因为我刚学PHP,现在是要把表单中的数据传递给别人 是不是应该按提交按钮时触发一个事件 然后用ajax传呢?
      

  3.   

    单一的PHP 是不能满足你的需求的 
    <script type="text/javascript">
    function fun_action_src(){
    var vals = document.getElementById('aid').value;
    document.getElementById('form1').action = "a.php?act="+vals;
    document.getElementById('form1').submit();
    //alert(vals);

    }
    </script>
    <form id="form1" action='' method='post'>
    <input id="aid" type='text' name='action' value=''/>
    <input onclick="fun_action_src()" type='button' name='sub' value='提交'/>
    </form>