php - Trying to change this from an image to a button, when I change it to look like a button I lose functionality
Solution:
This is occuring because input type="image" has the same functionality of a submit button, while input type="button" does not have any implicit functionality. (It is just a dumb clickable button)
You need to change it to input type="submit"
Answer
Solution:
Don't use type="button" in the submitting input! Try to use type="submit" in that "Go" field.
That's because the first attribute value prompt to the browser that the button is literally a normal object which doesn't have nothing to do with that form. Maybe you can use it as a link, or a Javascript event caller ... but not as the submitting action.
So the new code will be:
<form method='post' action='/login.php'>
<b>Name:</b><br><input type='text' name='name'
size='19' class='login'><br><b>Password:</b><br><input
type='password' name='password' size='19' class=
'login'><br>
<img src='/layout/blank.gif' height='6' width='1'
alt='blank'><br>
<input type='hidden' name='redir' value='$redir'>
<input type='submit' name=
'action' value='Go' style='vertical-align: middle;'
title='Login'> (<a href='/lostdetails.php' class=
'menu'>Lost Details?</a>)
</form>
Obviously you can put it in you PHP variable, your choice. If you want to learn more about HTML buttons, you can see the W3Schools documentation about it.
Andrea
Answer
Solution:
you should use type="submit"
and if you want to use the button, you should use the button tag
with type="submit"
Source