By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,053 Members | 1,125 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,053 IT Pros & Developers. It's quick & easy.

Alternative form submission

P: n/a
Is there a way to get an HTML form to be submitted (via POST) by using
an image button instead of a submit button for instance?

Feb 10 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
crater wrote:
Is there a way to get an HTML form to be submitted (via POST) by using
an image button instead of a submit button for instance?
<form action='foobar.php' method='post'>
<input type='image' src='foobar.png' />
</form>

Just check your (X)HTML reference for more details about <input
type='image'/>.
--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

http://acm.asoc.fi.upm.es/~mr/
Proudly running Debian Linux with 2.6.17-1-686 kernel, KDE3.5.3, and PHP
5.2.0-8 generating this signature.
Uptime: 17:15:18 up 16:04, 1 user, load average: 0.69, 2.05, 1.57

Feb 10 '07 #2

P: n/a
Just check your (X)HTML reference for more details about <input
type='image'/>.
I didn't think it would be as simple as that!
I take it therefore that any button in the form would achieve the same
end?

Feb 10 '07 #3

P: n/a
..oO(Ivn Snchez Ortega)
>crater wrote:
>Is there a way to get an HTML form to be submitted (via POST) by using
an image button instead of a submit button for instance?

<form action='foobar.php' method='post'>
<input type='image' src='foobar.png' />
</form>
<input type='image' src='foobar.png' alt='submit' />

Micha
Feb 10 '07 #4

P: n/a
On Feb 10, 5:00 pm, Michael Fesser <neti...@gmx.dewrote:
.oO(Ivn Snchez Ortega)
crater wrote:
Is there a way to get an HTML form to be submitted (via POST) by using
an image button instead of a submit button for instance?
<form action='foobar.php' method='post'>
<input type='image' src='foobar.png' />
</form>

<input type='image' src='foobar.png' alt='submit' />

Micha
Alternatively I think this might work (and for text etc. too):
<form action="file" method="post">
<input type="text" name="blah" />
</form>
<span onclick="javascript:document.forms[0].submit();">image, text or
whatever</span>

Feb 10 '07 #5

P: n/a
an*********@googlemail.com wrote:
Alternatively I think this might work (and for text etc. too):
<form action="file" method="post">
<input type="text" name="blah" />
</form>
<span onclick="javascript:document.forms[0].submit();">image, text or
whatever</span>
Don't *ever* suppose that the user has javascript enabled. Always provide an
alternative, non-javascript method for submitting the form, such as:

<form action="file" method="post">
<input type="text" name="blah" />

<noscript><input type='submit' /></noscript>

</form>
<span onclick="javascript:document.forms[0].submit();">image, text or
whatever</span>
--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

El placer es el bien primero. Es el comienzo de toda preferencia y de
toda aversión. Es la ausencia del dolor en el cuerpo y la inquietud en
el alma.
-- Epicuro de Samos. (341-270 a.C.) Filósofo griego.

Feb 10 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.