Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Senior Coder doubledee's Avatar
    Join Date
    Mar 2011
    Location
    Arizona
    Posts
    1,073
    Thanks
    26
    Thanked 0 Times in 0 Posts

    Submitting Form using Image

    I would like to switch from the default "Submit" button that HTML uses...

    Code:
    	<!-- 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...

    Code:
    	<!-- 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...

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

    What is the best way to fix this??

    Thanks,



    Debbie

  • #2
    Senior Coder
    Join Date
    Aug 2010
    Location
    High Point, NC
    Posts
    3,335
    Thanks
    5
    Thanked 363 Times in 360 Posts
    Cant you use

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

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

  • #3
    Senior Coder doubledee's Avatar
    Join Date
    Mar 2011
    Location
    Arizona
    Posts
    1,073
    Thanks
    26
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by teedoff View Post
    Cant you use

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

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

    Does this look correct...

    Code:
    <!-- 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

  • #4
    Senior Coder
    Join Date
    Aug 2010
    Location
    High Point, NC
    Posts
    3,335
    Thanks
    5
    Thanked 363 Times in 360 Posts
    Does it work?? lol. if so its correct. I dont have your button image to test it here.
    Teed

  • #5
    Senior Coder doubledee's Avatar
    Join Date
    Mar 2011
    Location
    Arizona
    Posts
    1,073
    Thanks
    26
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by teedoff View Post
    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?!


    Debbie

  • #6
    Senior Coder
    Join Date
    Aug 2010
    Location
    High Point, NC
    Posts
    3,335
    Thanks
    5
    Thanked 363 Times in 360 Posts
    Quote Originally Posted by doubledee View Post
    It seems to work, but just because something works doesn't mean it's right?!


    Debbie
    True....I think

    If you run your site link or ALL your code in the validator, it will at least point out coding errors.
    Teed

  • #7
    Senior Coder doubledee's Avatar
    Join Date
    Mar 2011
    Location
    Arizona
    Posts
    1,073
    Thanks
    26
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by teedoff View Post
    True....I think

    If you run your site link or ALL your code in the validator, it will at least point out coding errors.
    Good reminder!!!


    Debbie

  • #8
    New Coder
    Join Date
    Mar 2011
    Location
    Texas
    Posts
    22
    Thanks
    0
    Thanked 1 Time in 1 Post
    you can use the onClick() event to submit the form

    like getElementById('thisform').submit()
    Last edited by mark1976; 04-28-2011 at 06:38 AM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •