且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

一个表单中的两个图像按钮..如何给出代码..?

更新时间:2022-12-11 14:49:57

如果您坚持将表单发布到不同的操作,您应该不提供原始操作属性,但在提交前单击设置,并提交您的用javascript形成。这与php无关,甚至与MySQL无关。



 <   script     type   =  text / javascript    src   =  http://ajax.aspnetcdn.com/ajax/jQuery/ jquery-1.8.3.min.js >  <   / script  >  
< form name = login-or-register id = login-or-register 方法 = 发布 >
< 标签 = name-field > 名称:< / label >
< input 类型 = text 名称 = name-field id = name-field >

< 按钮 type = 按钮 id = register > 注册< / button >
< 按钮 类型 = 按钮 id = 登录 > 登录< / button >
< / form >
&lt ; script type = text / javascript >


(function(){


(#register)。click(function(event){E>

Hi,
in a login form there is two image buttons login and register. if i click on login button then it should redirect the page secure.php. if i click on register button then it should redirect the page registration.php.

can u just explain or give a solution.. how to give a code for form...?

If you stick to post your form to different actions, you should give no original action property, but set it on click before submit, and submit your form with javascript. This has nothing to do with php, even less with MySQL.

<script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.3.min.js"></script>
<form name="login-or-register" id="login-or-register" method="post">
 <label for="name-field">Name:</label>
    <input type="text" name="name-field" id="name-field">

 <button type="button" id="register">Register</button>
 <button type="button" id="login">Login</button>
</form>
<script type="text/javascript">


(function () {


("#register").click(function (event) {