![]() |
| HTML | PHP Scripts | Webmaster Tools | Webmaster Forums | Web Hosting | Domain Names | Webmaster Books |
|
|
#1 |
|
New Member
Join Date: Sep 2003
Webmaster Discussions: 19
Rep Power: 43 ![]() |
input type= image vs. submit
It appears when i set the input type to submit, the code works fine, but when i change it to image, just reloads the same page without submitting the info. how come?
Code:
<form method=post action="<%= Request.ServerVariables("SCRIPT_NAME") %>" name=login>
<input TYPE="submit" Name="action" value="login" src=login.jpg TABINDEX=3></td> *GOOD*
<input TYPE="image" Name="action" value="login" src=login.jpg TABINDEX=3></td> *NO GOOD*
</form>
|
|
|
|
|
|
#2 |
|
Administrator
Join Date: Aug 2000
Location: San Antonio
Webmaster Discussions: 3,296
Rep Power: 50 ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
I see no reason why it does not work, do you have a page that I can look at?
Dave |
|
|
|
|
|
#3 |
|
Administrator
|
The problem is 'probably' in the code that the form is submitted to, not the code itself. Try making the 'name' if the image input the same as the 'name' of the submit button.
__________________
If one of our members helps you, please click the icon to add to their reputation!No support via email or private message - use the forums! Before you ask, have you Searched? |
|
|
|
|
|
#4 | |
|
New Member
Join Date: Dec 2003
Webmaster Discussions: 5
Rep Power: 41 ![]() |
Having the same problem
Quote:
<INPUT type=submit name=add value=\"Add User\"> <B>Does not work:</B> <INPUT TYPE=image name=add SRC=images/buttons/add.jpg ALT=add VALUE=add> The form is submitting to itself and I have PHP that reads through the submitted data: if ( $this->rdata['add'] ) $this->add_user_form(); Once again, the submit button works fine, the image button does submit the 'name' to the form. Help? Thanks! |
|
|
|
|
|
|
#5 |
|
New Member
Join Date: Dec 2003
Webmaster Discussions: 5
Rep Power: 41 ![]() |
ok, I found out what was going on.
When it's just the submit button named add... it submits to the form with the value "add".... When it's the image... it submits to the form with the value "add_x". There is also a value for "add_y" which these values correspond to the x and y position of the mouse where you click on the picture. cheers |
|
|
|
|
|
#6 |
|
New Member
Join Date: Oct 2009
Location: Dhaka, Bangladesh
Webmaster Discussions: 2
Rep Power: 6 ![]() |
Dear Zamees, You can use inline css here just like that...
Code:
<form method=post action="<%= Request.ServerVariables("SCRIPT_NAME") %>" name=login>
<input TYPE="submit" Name="action" value="login" src=login.jpg TABINDEX=3></td> *GOOD*
<input TYPE="submit" Name="action" value="login" style="background:url(login.jpg); width:30px; height:30px;" TABINDEX=3></td> *ALSO GOOD*
</form>
Last edited by sbl; 10-06-2009 at 04:31 AM. |
|
|
|
![]() |
| Bookmarks |
| Tags |
| image, input, submit, type |
| Thread Tools | |
| Rate This Thread | |
|
|
Similar Webmaster Discussions
|
||||
| Thread | Webmaster Discussion Starter | Forum | Replies | Last Post |
| enable and disable the submit button with respect to radio button input | zzz | PHP Forum | 3 | 01-30-2009 04:32 AM |
| input type=hidden name="to" VALUE="user@yahoo.com" | hbass | HTML Forum | 1 | 06-08-2006 04:10 PM |
| Submit with Image tag that sends its own value | gohatesusall | HTML Forum | 9 | 11-11-2002 12:03 AM |
| Form input type | tbird | HTML Forum | 1 | 12-11-2000 07:37 PM |
| How do I type beside a cell | allstarr | HTML Forum | 10 | 10-28-2000 07:32 PM |