Reputation: 3418
I originally had a submit button like this
<form action="<?php $self ?>" method="post" >
<input name="search" type="hidden" >
<INPUT TYPE = "Submit" Name = "Submit1" VALUE = "search">
</form>
it made this statment true
if(isset($_POST['Search'])){}
For a time all was well then i made my submit button a image
<form action="<?php $self ?>" method="post" >
<input name="Search" type="hidden" />
<INPUT value="Search" TYPE="image" SRC="search.jpg" BORDER="0" ALT="Search">
</form>
For more time all was good untill i wanted to make this button into a text link..
I looked on the internet and read many things where i learned that it cant be done in html but java script was needed.. so i tryed to use this code but it no longer made my statment true..
this is the javascript submit button i found
<a href='javaScript:document.FORM_NAME.submit()'>Submit</a>
My two questions to you wizards out there are 1) where do i put the value of the submit? 2) how do i get this to replace my earlyer submit buttons?
Upvotes: 1
Views: 3692
Reputation: 6139
Just out of curiosity, how will users without javascript enabled submit the form?
How about using CSS to style submit input to look like a text rather than a button?
examples here: http://cssm.wordpress.com/2006/10/01/how-do-i-make-a-submit-button-look-like-text/ http://forums.digitalpoint.com/showthread.php?t=403667
Upvotes: 0
Reputation: 72510
For starters you need to give your form a name corresponding to what's in the Javascript link (in this case, FORM_NAME
):
<form name="FORM_NAME" action="<?php $self ?>" method="post" >
<input name="search" type="hidden" />
<a href='javaScript:document.FORM_NAME.submit()'>Submit</a>
</form>
Then on the page that checks the form, you need to check for $_POST['search']
, which comes from the input
. I don't think case matters, but it makes sense to always check using the same string anyway.
I'm not 100% sure what this form is meant to do since it doesn't seem to submit anything, don't you want to use a text input so the user can search for something?
Upvotes: 3
Reputation: 614
Making a button into a text link is simple CSS.
<input type="submit" id="submit" value="submit" class="submitbutton" />
CSS:
input.submitbutton{
margin: 0;
border: none;
background-color: transparent;
padding: 0;
}
/* Make sure the hover has the same element properties as the first, obviously changing the font colour on hover is something acceptable */
input.submitbutton:hover{
margin: 0;
border: none;
background-color: transparent;
padding: 0;
}
Upvotes: 8
Reputation: 6139
If you want an image as a submit button? Why not use the button element
<button name="search" value="search" type="submit">
Send<img src="/icons/wow.gif" alt="wow" /></button>
see: http://www.w3.org/TR/html401/interact/forms.html#h-17.5
Upvotes: 0