View Full Version : how to change submit button
gurmeet
10-10-2009, 03:24 PM
i need help on these two topice....
1. i want to place a Image on sumbit button... how to change it?
means i want a picture at the place of submit button?
-------------------
2. can i add two submit button on a single form, means i want two buttons and want two diffrent file to b loaded.
click on 1st submit - open file1.html
clik on 2nd button - open file2.html
is it possible? or how to achieve it..? plz give ur suggestions...
forum_amnesiac
10-10-2009, 05:00 PM
To replace the button with an image you can use this syntax:
<input type="image" src="submit.gif" value="Send This Form" alt="Submit Enquiry" name="image">
djr33
10-11-2009, 03:42 AM
Yes, as above you don't use any submit button... just use an "image" input and it works just like a submit button by default. (However, the result is a little confusing for some users, so be sure it clearly says "SUBMIT" or "CLICK HERE" etc., or novice users might not know how to submit the form.)
As for submitting to two pages, here's a basic summary:
1. Forms have an "action", a page they submit to. You can't have two for one form.
2. You CAN change the action of the form with Javascript, so if you want to rely on Javascript you can have a function attached to hitting the submit button (or image) that changes the action to the desired page. That won't work on all browsers, though.
3. Your submit button or image has a VALUE, and a name. Name all of the submit inputs the same thing (like "submit"), and then serverside (with php, etc.) you can check which one was clicked (ie, submit=register, or submit=deleterecord, etc.).
4. Using that different value, you can use PHP or another serverside language to do two different things with the data, or even display two different pages (by using a big if statement-- if a { display this page content } else { display another page content }. In fact, you could use includes in that to actually include two different pages of code (but it would still technically be one page, just displayed very differently. Again, you can't actually submit to a variable url).
The problem with trying to submit to two different pages is that you need one form per action, so you can have two forms on a page easily, but not the same inputs being used in two forms.
I hope this gets you started. Once you know how to want to continue, give us more information and we can help with specifics.
gurmeet
10-11-2009, 05:39 AM
thnks dear....
for more precise, i want to tell u that i wwant to amke a disscussion board... in reply or in new thread i want to make three buttons:-
1. Post Thread
2. Preview
3. Clear
i just want , when user clicks on the 'post Thread' button, a form must b submitted and when clicks on 'preview' button, the preview must b there on the screen....
djr33
10-11-2009, 05:12 PM
Making a discussion board is much more complex than this-- this won't be one of your biggest problems.
However, if you do it get all to work, then you will have a complex setup with PHP anyway, so using the method of PHP deciding which button was pressed makes sense.
So, you will have three buttons:
1. A reset button-- this is not submitted, but rather just a regular reset button. (I'm not positive how you can use an image instead of a reset button, but it should not be too hard to find that on google... never had to do it, myself).
2. A "post" submit button. Just submit to the action page, using the name submit and value "post"-- the PHP on the next page will take that value and do the action of posting, rather than something else.
3. A "preview" submit button. Same as post, just send with value "preview" and the php will check that and then do the preview action. Just big if statements, basically.
FrickenTrevor
10-12-2009, 10:08 PM
gurmeet
If you want cool butons, try http://www.catswhocode.com/blog/top-10-css-buttons-tutorial-list
However, if you want to do a forum type thing, I sugest you look into PhP.
http://www.php.net/
If thats too complicated, try W3schools
http://www.w3schools.com/PHP/DEfaULT.asP
Hope this helps :)
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.