markvaughn2006 Posted October 4, 2009 Share Posted October 4, 2009 Is there a way to use a custom submit button instead of the regular html form button?? AND is there a way to have all the functionality of the code below but instead of having a submit button, there is a <a href link?? Thanks for any help!! <?php echo '<form target="remove link" method="post" action="sub/removelink.php"><input type="submit" value="Remove" />'.$row['quicklinktitle1'].'<input type="hidden" name="remove" value="'.$row['quicklinktitle1'].'" /></form>'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/176433-custom-submit-form-button/ Share on other sites More sharing options...
mikesta707 Posted October 4, 2009 Share Posted October 4, 2009 you can create an image submit button <INPUT TYPE="image" SRC="images/submit.gif" HEIGHT="30" WIDTH="173" BORDER="0" ALT="Submit Form"> and for a link you can have it submit onclick <a href="#" onclick="document.form.submit()">submit</a> where form is the name of your form Quote Link to comment https://forums.phpfreaks.com/topic/176433-custom-submit-form-button/#findComment-930007 Share on other sites More sharing options...
ProXy_ Posted October 4, 2009 Share Posted October 4, 2009 You could always use an image <img src="blah.jpg" onClick="submitform()"> The [b]Javascript[/b] function would look something like this: <head> <SCRIPT language="JavaScript"> function submitform() { document.formname.submit(); } </SCRIPT> </head> Hope this helps. Quote Link to comment https://forums.phpfreaks.com/topic/176433-custom-submit-form-button/#findComment-930008 Share on other sites More sharing options...
mikesta707 Posted October 4, 2009 Share Posted October 4, 2009 also note, you can alter the style of the normal submit button via CSS Quote Link to comment https://forums.phpfreaks.com/topic/176433-custom-submit-form-button/#findComment-930012 Share on other sites More sharing options...
CarbonCopy Posted October 4, 2009 Share Posted October 4, 2009 Using CSS you can make your submit button look like just about anything. You probably will want to use value="" (Assuming the image has text), and you should set your border to none. Quote Link to comment https://forums.phpfreaks.com/topic/176433-custom-submit-form-button/#findComment-930263 Share on other sites More sharing options...
haku Posted October 5, 2009 Share Posted October 5, 2009 and for a link you can have it submit onclick Using javascript for submissions is bad practice, as anyone with javascript turned off, or using a javascript incompatible device will not be able to submit the form. You could always use an image <img src="blah.jpg" onClick="submitform()"> The Javascript function would look something like this: <head> <SCRIPT language="JavaScript"> function submitform() { document.formname.submit(); } </SCRIPT> </head> Same as above - javascript is not a good way to go with this. Using CSS you can make your submit button look like just about anything. You probably will want to use value="" (Assuming the image has text), and you should set your border to none. This is the best advice so far, except that value should not be left blank, as anyone using a screen reader or anyone who has images turned off will not be able to see the submit button. Rather, the text should be hidden using CSS, there are various ways of doing this. Finally, for other solutions to the issue, you can use inputs of type image, or type button: <input type="image" /> <input type="button" /> And style these how you want. Google will give you more information on how to work with them. Quote Link to comment https://forums.phpfreaks.com/topic/176433-custom-submit-form-button/#findComment-930382 Share on other sites More sharing options...
CarbonCopy Posted October 5, 2009 Share Posted October 5, 2009 Yeah, forgot about screen readers. I just really started making my sites accessible (I know I know). Quote Link to comment https://forums.phpfreaks.com/topic/176433-custom-submit-form-button/#findComment-930987 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.