Results 1 to 9 of 9

Thread: Submit Button Help Needed

Hybrid View

  1. #1

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

  4. #4
    What exactly do you want the form to do?

  5. #5
    Join Date
    Dec 2008
    Location
    Redmond, Oregon
    Posts
    828
    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
    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
    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
    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
    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, 17: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
  •