<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??

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

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.

try document.login.submit() .. where login is the name of the form ...

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>

i just copied yer exact code and it worked for me !!!

maybe its your web browser :P ...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.