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

I have created 2 pages – Product Page & Checkout Page
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”>
<!– 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 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”>

<input type=”email” class=”form-control” id=”user_login” name=”log” placeholder=”Email ID” value=”” size=”20″>
<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″ />

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.


This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.