form help - custom image submit button


I am having issues with my form when I try to use a custom image for a submit button. Everything seems to work fine (valid email check, return success page) except the email never actually goes through. It only happens when I put in the custom image for the submit button.

Here is the code in the HTML:


	<form name="dform" action="email.php" onsubmit="return validateForm();" method="post">

	<input type="hidden" value="" name="email" />
	<input type="hidden" value="Mailing List Submission" name="subject"/>

	<p><input type="text" name="your_email" size="55" class="form_field" style="overflow:hidden;" value="enter email address" >
	<br />
	<input type="image" name="submit" src="images/submitcheck.png" border="0" align="right" style="margin-top:2px" />


if(isset($_POST[‘submit’])) {

# Form declarations
$to = ""; 
$subject = "Mailing List Submission";
$from = "Mailing List Submission"; 
$your_email_field = $_POST['your_email'];
$body = "
Email: $your_email_field\n";

$success = mail($to, $subject, $body, “From: “$name_field” <$your_email_field>”);


if ($success){
} else {



Well, there is no “image” submit button for standard HTML. This is actually a slight variation on Javascript image buttons. It is fairly easy to fix. You code:

Should be changed to add the submit command in “Javascript” format, like this:

This will actually submit the form for you. Good luck!


Thanks! Unfortunately it is still not working :frowning: Do I need to put a tag somewhere telling the browser that there is text/javascript?


Well, I have done some further research for you and found that this format is supposed to work:

But, that was your original format with some styling included. Try it without the styling…

Also, I found this noted as the way to do the same thing:

(you place a standard tag where the “…” is…)

Next, I found that some issues can be caused do the the image not showing up as a “SUBMIT” value.
So, to fix that, you have to add the value to the image tag:

This last one is most likely the issue. It seems that if you do not put in the “VALUE” option in the image input, that submit is not passed to PHP. So, your code on the ACTION page will not realize the page was posted as most ACTION code includes – if(isset($_POST[‘submit’])) – which would never be true with the “VALUE”.

Hope that helps… Good luck…


thanks for your help! I figured it out :slight_smile: in the email.php doc, this

if(isset($_POST[‘submit’])) { [/php]
should be changed to

if(isset($_POST[‘submit_x’])) { [/php]

and the input button was changed to

		<input type="image" name="submit" value="submit" src="images/submitcheck.png" border="0" align="right" style="margin-top:2px" onclick="javascript:document.frmdform.submit();" />

it works! thanks again!