droidus
droidus

Reputation: 641

Why doesn't anything happen when I click this submit button?

I am having trouble creating an image submit button. When I click on it, nothing happens. Here is my code:

<input type="image" src="notify_me.png" name="submit" id="submit" OnClick="this.disabled = true" value=""/>

if($_POST) {

Upvotes: 0

Views: 63

Answers (2)

Lazerblade
Lazerblade

Reputation: 1127

Add return true after your disable onClick event.

<input type="image" src="notify_me.png" name="Submit" id="submit" onClick="this.disabled = true; return true;" value="" />

Upvotes: 0

Gustavo Gondim
Gustavo Gondim

Reputation: 1643

You need to submit the form at the click event:

<input type="image" src="notify_me.png" onclick="document.forms[0].submit();" />

You should also use the input of type submit:

<input type="submit" style="width:(width); height:(height); background-image:url('notify_me.png'); border:none; padding:0;" />

Upvotes: 1

Related Questions