1

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?

1
  • 2
    Why did you have to use JavaScript in the first place if it was already working fine? Commented Oct 2, 2009 at 12:46

4 Answers 4

8

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;
}
Sign up to request clarification or add additional context in comments.

Comments

3

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?

Comments

0

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

2 Comments

Because IE doesn't support <button>
He said he wanted a text link.
0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.