...

View Full Version : Submitting Form using Image



doubledee
04-28-2011, 04:09 AM
I would like to switch from the default "Submit" button that HTML uses...



<!-- Submit Form -->
<fieldset id="submit">
<input name="submit" type="submit" value="Place Order" />
<input name="submitted" type="hidden" value="true" />
</fieldset>


...to an image for my "Submit" button like this...



<!-- Place Order Button -->
<p id="button">
<a href="secure/checkout.php">
<img src="images/PlaceOrder_bk.png" border="0" alt="Place Order" />
</a>
</p>



The problem is that I believe this messes up this code that fires off my PHP to process the form...



// ************************************************
// HANDLE FORM.
// ************************************************
if (isset($_POST['submitted'])){



What is the best way to fix this??

Thanks,



Debbie

teedoff
04-28-2011, 04:19 AM
Cant you use

<input type="image" src="myImage" />
or maybe

<input type="button" src="myImage" />

doubledee
04-28-2011, 04:28 AM
Cant you use

<input type="image" src="myImage" />
or maybe

<input type="button" src="myImage" />


Does this look correct...



<!-- Submit Form -->
<fieldset id="submit">
<input name="submit" type="image" src="../images/PlaceOrder_bk.png" value="Place Order" />
<input name="submitted" type="hidden" value="true" />
</fieldset>



Debbie

teedoff
04-28-2011, 04:33 AM
Does it work?? lol. if so its correct. I dont have your button image to test it here.

doubledee
04-28-2011, 04:50 AM
Does it work?? lol. if so its correct. I dont have your button image to test it here.

It seems to work, but just because something works doesn't mean it's right?! :p


Debbie

teedoff
04-28-2011, 05:04 AM
It seems to work, but just because something works doesn't mean it's right?! :p


Debbie

True....I think

If you run your site link or ALL your code in the validator (http://validator.w3.org), it will at least point out coding errors.

doubledee
04-28-2011, 05:06 AM
True....I think

If you run your site link or ALL your code in the validator (http://validator.w3.org), it will at least point out coding errors.

Good reminder!!!


Debbie

mark1976
04-28-2011, 07:35 AM
you can use the onClick() event to submit the form

like getElementById('thisform').submit()



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum