Html 界面的代码..界面上有两个按钮 "登录"  和 "注册"<form id="form1" name="form1" method="post" action="login1.php">
  <table width="894" height="426" border="1">
    <tr>
      <td width="270" height="110">&nbsp;</td>
      <td width="82">&nbsp;</td>
      <td width="179"><span class="STYLE1">欢迎登录STR</span></td>
      <td width="157">&nbsp;</td>
      <td width="172">&nbsp;</td>
    </tr>
    <tr>
      <td height="36">&nbsp;</td>
      <td>User ID:</td>
      <td><label>
        <input name="txt_user" type="text" id="txt_user" />
      </label></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td height="57">&nbsp;</td>
      <td>Pass Word:</td>
      <td><input name="txt_password" type="password" id="txt_password" /></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td height="63">&nbsp;</td>
      <td><label>
        <div align="right">
          <input type="submit" name="Submit" value="登  录" />
        </div>
      </label></td>
      <td><label>
        &nbsp; &nbsp; &nbsp;<input type="submit" name="Submit2"  value="注  册"  />
      </label></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
  </table>
</form>login1.php 中php代码:
<?php 
error_reporting(0);   
$mysql_servername = "127.0.0.1";   
$mysql_username = "root";   
$mysql_password ="root";   
$mysql_database ="t_user"; //数据库名if(isset($_POST['Submit'])){
  mysql_connect($mysql_servername , $mysql_username , $mysql_password);
  mysql_select_db($mysql_database);   
  mysql_query("SET NAMES 'gbk'");
  $tname=$_POST['txt_user'];   
  $tpassowrd=$_POST['txt_password'];   
  if ($tname && $tpassowrd)
{   
      $sql = "SELECT * FROM t_user WHERE cUserID = '$tname' and password='$tpassowrd'";   
      $res = mysql_query($sql); 
      $rows=mysql_num_rows($res);    
      if($rows)
    { 
     echo "<script langrage=javascript>alert('恭喜您登陆成功')</script>";
      echo "<script>window.location.href='Index_STR.php';</script>";
      exit;   
     }
     else
    {
         echo "<script language=javascript>alert('用户名密码错误');history.back();</script>";   
    }
   }
  else
  {   
  echo "<script language=javascript>alert('用户名密码不能为空');history.back();</script>";   
  }
}
?>这php代码只能执行html中"登录" 按钮,怎么才能触发“注册” 按钮啦..
我想点击"注册" 按钮跳出一个新的界面re.html...

解决方案 »

  1.   

    <input type="button" name="Submit2" value="注 册" onClick="navigate('php.php')"/>
    改成这样 php.php就是你想跳转的页
      

  2.   

    也可以 <input type="button" name="Submit2" value="注 册" onClick="document.location.href='php.php'"/>
      

  3.   

     这样不跳转哦? 它跳转到“login1.php” 这个页面,而这个页面是我实现登录按钮代码判断页面?
      

  4.   

    用js改变form 的action就行了啊。
      

  5.   

    把php.php改为你注册的页面不行吗?