Results 1 to 6 of 6

Thread: how to change submit button

  1. #1
    Join Date
    Feb 2009
    Posts
    156
    Thanks
    0
    Thanked 4 Times in 3 Posts

    Default how to change submit button

    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...

  2. #2
    Join Date
    Apr 2009
    Location
    Cognac, France
    Posts
    400
    Thanks
    2
    Thanked 57 Times in 57 Posts

    Default

    To replace the button with an image you can use this syntax:

    HTML Code:
    <input type="image" src="submit.gif" value="Send This Form" alt="Submit Enquiry" name="image">

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    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.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  4. #4
    Join Date
    Feb 2009
    Posts
    156
    Thanks
    0
    Thanked 4 Times in 3 Posts

    Default

    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....

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    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.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  6. #6
    Join Date
    Aug 2009
    Location
    utf-8
    Posts
    205
    Thanks
    4
    Thanked 7 Times in 7 Posts

    Exclamation

    gurmeet


    If you want cool butons, try http://www.catswhocode.com/blog/top-...-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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •