Results 1 to 9 of 9

Thread: Submit Button Help Needed

  1. #1
    ayebea's Avatar
    ayebea is offline Net Builder
    Join Date
    Apr 2009
    Location
    In Internet
    Posts
    180
    Blog Entries
    2
    Thanks
    45
    Thanked 14 Times in 14 Posts

    Submit Button Help Needed

    Hello,

    I have a site ...I want someone click on Submit button then he'll redirect to another page...but I am confused about code .


    Please Suggest me


    Thanks
    AB

  2. #2
    Aziz's Avatar
    Aziz is offline no investment, no glory
    Join Date
    May 2009
    Location
    IL
    Posts
    736
    Thanks
    588
    Thanked 243 Times in 168 Posts
    Hi,

    I guess there are few ways to achieve this but it depends on how you wish to do it / how complex it is.

    The simplest way is to assign the <form> (which the submit button is within) to a specified action URL.

    This goes like this (HTML):

    Code:
    <form action="http://www.example.com" method="post">
        <div>
            <!-- ...form elements, fields, labels etc... -->
            <input type="submit" value="Submit" /> 
            <input type="reset" value="Reset" />
        </div>
    </form>
    change www.example.com to desired URL.

  3. #3
    stickycarrots's Avatar
    stickycarrots is offline Experienced Net Builder
    Join Date
    Dec 2008
    Location
    QuickInbox.com
    Posts
    753
    Blog Entries
    6
    Thanks
    18
    Thanked 86 Times in 59 Posts
    What exactly do you want the form to do?

  4. #4
    ayebea's Avatar
    ayebea is offline Net Builder
    Join Date
    Apr 2009
    Location
    In Internet
    Posts
    180
    Blog Entries
    2
    Thanks
    45
    Thanked 14 Times in 14 Posts
    Quote Originally Posted by Aziz View Post
    Hi,

    I guess there are few ways to achieve this but it depends on how you wish to do it / how complex it is.

    The simplest way is to assign the <form> (which the submit button is within) to a specified action URL.

    This goes like this (HTML):

    Code:
    <form action="http://www.example.com" method="post">
        <div>
            <!-- ...form elements, fields, labels etc... -->
            <input type="submit" value="Submit" /> 
            <input type="reset" value="Reset" />
        </div>
    </form>
    change www.example.com to desired URL.
    Thanks for your suggestion .....but it's can work for me...when I click on Submit Button ...It'll redirect me to same page ...

    Any other way?

    Thanks in advance

    AB

  5. #5
    Mr.Bill's Avatar
    Mr.Bill is offline One is glad to be of service
    Join Date
    Dec 2008
    Location
    Redmond, Oregon
    Posts
    828
    Blog Entries
    1
    Thanks
    72
    Thanked 350 Times in 182 Posts
    you are going to need to provide someone the code in order to help resolve this. Does the page give off a on page confirmation when there has been a successful submission?

    Reverse IP Check ಠ_ಠ Proxy Sites
    <?php if ($youask == 'stupid question') { echo ('stupid answer'); } ?>

  6. #6
    ayebea's Avatar
    ayebea is offline Net Builder
    Join Date
    Apr 2009
    Location
    In Internet
    Posts
    180
    Blog Entries
    2
    Thanks
    45
    Thanked 14 Times in 14 Posts
    This is form page Untitled Form at the bottom of this page ..their is SUBMIT button...when someone click on that ..it'll redirect to Login


    Please suggest me

  7. #7
    TopDogger's Avatar
    TopDogger is offline Über Hund
    Join Date
    Jan 2009
    Location
    Hellfire, AZ
    Posts
    2,946
    Thanks
    341
    Thanked 883 Times in 671 Posts
    You did not follow the instructions that Aziz gave you. It submits to the same form because you did not specify where it should go. action= should specify where the page needs to be directed when someone clicks on the submit button.
    "Democracy is two wolves and a lamb voting on what to have for lunch. Liberty is a well-armed lamb contesting the vote." -- Benjamin Franklin


  8. #8
    r.pointing is offline Unknown Net Builder
    Join Date
    Jul 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hey:

    I have several "submit" buttons on a form. I want users to be able to hit the "enter" key to submit the form. The page used to "post" the information checks for specifically what form button was pushed to submit the form before executing the appropriate code. I am automatically submitting the page when the enter key is hit, but it is defaulting to the first option of executed code in the post page.

  9. #9
    Andy101's Avatar
    Andy101 is offline Code Otaku
    Join Date
    Aug 2009
    Location
    Kanazawa
    Posts
    1,177
    Thanks
    163
    Thanked 297 Times in 224 Posts
    For the submit buttons you can assign a different "value" for each one and then detect it in the PHP of the web page.

    Then redirect the visitor to the required page before any HTML has been sent to the browser.

    For example:
    PHP Code:
    if (isset($_POST['action'])) {
        switch (
    $_POST['action']) {
            case 
    'action1':
                
    header'Location: http://yoursite.com/page1.php' );
                break;
            case 
    'action2':
                
    header'Location: http://yoursite.com/page2.php' );
                break;
        }

    So in your submit buttons you have value="action1" etc. And the form initially submits back to the same page. Then the PHP code handles the redirection.

    Another way is to use Javascript with onClick events for each button redirecting the browser.

Similar Threads

  1. Google introduces the +1 button
    By Franc Tireur in forum Social Networks
    Replies: 1
    Last Post: 31 January, 2012, 16:31 PM
  2. facebook like button ?
    By SonnyCooL in forum Wordpress
    Replies: 1
    Last Post: 15 September, 2010, 21:17 PM
  3. Button Firefox
    By Nazzareno in forum Forum Life
    Replies: 0
    Last Post: 12 September, 2009, 20:23 PM
  4. Help needed to adjust tweet button in wordress
    By badmash in forum Wordpress
    Replies: 5
    Last Post: 6 September, 2009, 02:44 AM
  5. Seomoz share button
    By GameOver in forum Promoting
    Replies: 1
    Last Post: 14 May, 2009, 03:05 AM

Tags for this Thread

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
  •