How to code an image button to call mail.php on contact form |
How to code an image button to call mail.php on contact form |
larry78723 |
Mar 29 2020, 02:28 PM
Post
#1
|
Member Group: Members Posts: 39 Joined: 5-March 20 Member No.: 27,220 |
My contact form starts with:
<form id="form1" method="POST" action="mail.php"> I'd like to replace the last line in my contact from: <button type="submit" value="Send" style="margin-top:15px; margin-left: 500px; text-align: center;">Send Email</button> with one that contains <img src="images/button_send-email.png" alt="Email"> but have no idea what it should look like. I tried <a href "mail.php" <img src="images/button_send-email.png" alt="Email"> > but the button doesn't even show. Please teach me how this should be done. Thanks in advance, Larry |
Christian J |
Mar 29 2020, 03:02 PM
Post
#2
|
. Group: WDG Moderators Posts: 9,665 Joined: 10-August 06 Member No.: 7 |
I'd like to replace the last line in my contact from: <button type="submit" value="Send" style="margin-top:15px; margin-left: 500px; text-align: center;">Send Email</button> with one that contains <img src="images/button_send-email.png" alt="Email"> You might put the IMG element in a BUTTON TYPE=SUBMIT element: CODE <button type="submit" name="foo" value="bar"><img src="dog.jpg" width="100" height="50" alt="Send"></button> (some extra CSS tweaking might be necessary, different browsers often handle form element styling differently). You can also use TYPE=IMAGE with an INPUT submit button, see https://htmlhelp.com/faq/html/all.html#custom-button QUOTE I tried <a href "mail.php" <img src="images/button_send-email.png" alt="Email"> > but the button doesn't even show. You can't submit forms with HTML links, you need buttons (or, less accessible, the javascript onclick event on any element). |
larry78723 |
Mar 29 2020, 05:01 PM
Post
#3
|
Member Group: Members Posts: 39 Joined: 5-March 20 Member No.: 27,220 |
Thanks Christian
|
Lo-Fi Version | Time is now: 13th May 2024 - 04:22 AM |