zoukankan      html  css  js  c++  java
  • PHP和JS实现多按钮提交表单

    JS:

        <html>   
        <head>   
        <script>   
            function submitit1()   
            //交由程序1处理        
            {   
                document.myForm.action = "http://www.site.com/cgi1.php"   
                document.myForm.submit();   
            }   
            function submitit2()   
            //交由程序2处理        
            {   
                document.myForm.action = "http://www.site.com/cgi2.php"   
                document.myForm.submit();   
            }   
        </script>   
        </head>   
           
        <body>   
        <form name="myForm" METHOD=POST>   
            username:<input type=text name=text1>    
            password:<input type=password name=text2>   
            <input type=button value="Submit1" onClick=submitit1();>   
            <input type=button value="Submit2" onClick=submitit2();>   
        </form>   
        </body>   
        </html> 
    

     PHP:

        <?php      
         echo   "$sub<br>
    ";      
         if   ("s1"==$sub)      
         {      
             ...      
         }      
         else   if   ("s2"==$sub)      
         {      
             ...      
         }      
         ?>      
         <html>      
         <head><title></title></head>      
         <body>      
         <form   action="<?php   print("$PHP_SELF");   ?>"   method="get">      
         <input   type="submit"   name="sub"   value="s1">      
         <input   type="submit"   name="sub"   value="s2">      
         </form>      
         </body>      
         </html>      
         ?>   
    
  • 相关阅读:
    TCP报文
    TCP概述
    UDP
    传输层概述
    端口地址转换 PAT
    网络地址转换NAT原理介绍
    js的时间处理函数
    正则表达式相关笔记
    微信小程序实现图片拖拽
    在React中使用less
  • 原文地址:https://www.cnblogs.com/mypsq/p/5311217.html
Copyright © 2011-2022 走看看