Jump to content

Custom "Submit" form button??


markvaughn2006

Recommended Posts

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>';

?>

Link to comment
https://forums.phpfreaks.com/topic/176433-custom-submit-form-button/
Share on other sites

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

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.

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.