0
<form action="<?php echo $_SERVER['PHP_SELF']?>" method="post">
					<table cellpadding="0" cellspacing="0">
					<tr>
						<td height="35" width="80">Username:</td>
						<td><input type="text" name="username"></td>
					</tr>
					<tr>
						<td height="35">Password:</td>
						<td><input type="password" id="pass" name="pass"></td>
					</tr>
					</table> 
                     <input type="submit" name="submit" value="Login">          
                    <input name="submit" type="image" src="./images/button.png" style="width: 160px; height: 25px; margin-left: 35px; margin-bottom: -20px; margin-top: 20px;"><a href="" style="color: white; text-decoration: none; font-weight: bold; position: relative; top: 12px; left: -95px; font-size: 12px;">Login</a>
					</form>

I have that code for a login form. When I click the first button (simple button, no alterations), it works perfectly fine.

However, when I click on the second login button, the one with all the graphic alterations (which is an image) all that happens is that the page reloads - meaning that the information has not been submitted. The same happens if I press on the "Login" text in the <a></a> tags.

Any help in solving this??

2
Contributors
5
Replies
6
Views
6 Years
Discussion Span
Last Post by dos_killer
0

yes that is because when you set type=submit...it actualy submits the form contents...a normal button does not "submit" the contents unless an action for it is defined...
and having <a href="">Login</a>doesnt make it submit the data either....
if you want to define a normal button like the way you have done above and make it submit the form..then you gotta define an action using javascript

0

So if I name my form "login" then this should work for the "Login" text

<script type="text/javascript">
function submitform()
{
    document.forms["login"].submit();
}
</script>


<a href="javascript:submitform()" 

or onClick for the button.

And that doesn't work.

Edited by Cuchara: n/a

0

Hhmmm, still not working. Any other suggestions?

Code:

<script type="text/javascript">
function submitform()
{
    document.login.submit();
}
</script>              
					<form id="login" action="<?php echo $_SERVER['PHP_SELF']?>" name="login" method="post">
					<table cellpadding="0" cellspacing="0">
					<tr>
						<td height="35" width="80">Username:</td>
						<td><input type="text" name="username"></td>
					</tr>
					<tr>
						<td height="35">Password:</td>
						<td><input type="password" id="pass" name="pass"></td>
					</tr>
					</table> 
                     <input type="submit" name="submit" value="Login">          
                    <input name="submit" type="image" src="./images/images/button.png" style="width: 160px; height: 25px; margin-left: 35px; margin-bottom: -20px; margin-top: 20px;" onClick="javascript: submitform()"><a href="javascript: submitform()" style="color: white; text-decoration: none; font-weight: bold; position: relative; top: 12px; left: -95px; font-size: 12px;">Login</a>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.