javascript - Using Image to Submit Form Issue -
i have tried several different submit buttons can not seem work properly.
<form id="logform" action="<?php $retpage; ?>" method="post" name="logform"> <div> <table width="400px" border="0" cellpadding="4" cellspacing="4" class="loginform"> <tr> <td colspan="2"> </td> </tr> <tr> <td width="28%">email:</td> <td width="72%"> <input name="usr_email" type="text" class="required" id="txtbox" size="25" value="<?php if(isset($_cookie['user_name'])){ print ($_cookie['user_name']); } else if(isset($_post['usr_email'])){ print ($_post['usr_email']); } else { print '';} ?>"> </td> </tr> <tr> <td>password:</td> <td><input name="pwd" type="password" class="required password" id="txtbox" size="25"></td> </tr> <tr> <td colspan="2"> <div align="center"> <input name="remember" type="checkbox" id="remember" value="1"> remember me </div> </td> </tr> <tr> <td colspan="2"> <div align="center"> <p><input name="dologin" type="image" id="dologin" value="login" src="images/login.png" style="vertical-align: middle; height: 30px; width: 66px;" onsubmit="document.logform.submit(); return false;" /></p> <p><a href="signup.php">register free</a><font color="#ff6600">|</font> <a href="forgot.php">forgot password</a> <font color="#ff6600"></font></p> </div> </td> </tr> </table> </div> </form> when use below submit button, works prefectly, want use image submit. above login button not work.
<input name="dologin" type="submit" id="dologin" value="login"> any suggestions?
take out onsubmit attribute , use:
<input type="image" src="foo.png" /> this submit form when clicked.
fiddle: http://jsfiddle.net/jonathansampson/q3sn8/
additionally, you're not printing action:
action="<?php $retpage; ?>" // should <?php echo $retpage; ?>
Comments
Post a Comment