Web Hosting
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to pass Form values to another page after Login in WordPress

Discussion in 'WordPress Theme Customization' started by Minesh, Apr 10, 2017.

  1. Minesh

    New Member

    Joined:
    Apr 10, 2017
    Messages:
    2
    Likes Received:
    0
    I have created 2 pages – Product Page & Checkout Page in WordPress.

    I have created a form on Product Page.

    Following is the code:

    <form method=”POST” action=””>
    <div class=”form-group”>
    <label for=”amt”>Amount</label>
    <input type=”number” class=”form-control” name=”amt_pay” id=”amt” placeholder=”Amount”>
    </div>
    <!– Button trigger modal –>
    <button type=”button” class=”btn btn-default” data-toggle=”modal” data-target=”#myModal”>Make Payment</button>

    <!– Modal –>
    <div class=”modal fade” id=”myModal” tabindex=”-1″ role=”dialog” aria-labelledby=”myModalLabel”>
    <div class=”modal-dialog” role=”document”>
    <div class=”modal-content”>
    <div class=”modal-header”>
    <button type=”button” class=”close” data-dismiss=”modal” aria-label=”Close”><span aria-hidden=”true”>×</span></button>
    <h4 class=”modal-title” id=”myModalLabel”>Login</h4>
    </div>
    <div class=”modal-body”>
    <form class=”form-horizontal” name=”loginform” id=”loginform” action=”<?php echo esc_url( site_url( ‘wp-login.php’, ‘login_post’ ) ); ?>” method=”post”>

    Email
    <input type=”email” class=”form-control” id=”user_login” name=”log” placeholder=”Email ID” value=”” size=”20″>
    Password
    <input type=”password” class=”form-control” id=”user_pass” name=”pwd” placeholder=”Password” value=”” size=”20″>
    <input type=”checkbox” id=”rememberme” name=”rememberme” value=”forever”> Remember me
    <button type=”submit” class=”btn btn-warning” id=”wp-submit” name=”wp-submit” value=”Log In”>Login</button>
    <input type=”hidden” name=”redirect_to” value=”<?php echo home_url(); ?>/checkout” />
    <input type=”hidden” name=”testcookie” value=”1″ />
    </form>
    </div>
    </div>
    </div>
    </div>
    </form>

    Checkout Page contains following code:

    <?php echo $_POST[‘amt_pay’]; ?>

    If I keep a simple submit button instead of Modal for Login on Product Page. The code works fine. If user clicks submit button the form value gets display on Checkout Page.

    But I want a login system in between. Hence I added a login form in Modal on Product Page.

    The problem is that the user gets login easily and gets redirected to Checkout Page from this form but the form value doesn’t passes to the Checkout page. It remains blank.

    I googled but remain with no luck.

    Plz provide me the code to pass form variables to checkout page after login.

    Thanks
     
    #1

Share This Page

Web Hosting