0

I am creating an eCommerce theme. I have created 3 Pages – Contribute Page, Login Page & Checkout Page.

On Contribute Page there is a form. Following is the code:

<form method="POST" action="http://www.example.com/login">

  <input type="number" name="amount" min="1" placeholder="Total Amount" required>
  <button type="submit" >Continue</button>
  <input type="hidden" name="amount_title" value="I just want to pay this amount." />

</form>

On Login Page there is a Login Form. Following is the code:

<form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="POST"> 
          <ul>                                                    
             <li>Email</li>
             <li> <input type="text" id="user_login" name="log" placeholder="Email ID" value="" size="20"></li>
             <li>Password</li>
             <li><input type="password" class="form-control" id="user_pass" name="pwd" placeholder="Password" value="" size="20"></li>
             <li><input type="checkbox" id="rememberme" name="rememberme" value="forever"> Remember me</li>
             <li><button type="submit" class="btn btn-warning" id="wp-submit" name="wp-submit" value="Log In">Login</button></li>
          </ul>
             <input type="hidden" name="redirect_to" value="http://www.example.com/checkout?amount=<?php echo $_REQUEST['amount']; ?>&amount_title=<?php echo $_REQUEST['amount_title']; ?>" />
</form>

And on Checkout Page following is the code:

<?php echo $_REQUEST['amount']; ?>
<?php echo $_REQUEST['amount_title']; ?>

Every thing is working perfect. The value of the ‘amount‘ is echoing perfectly on Checkout Page but the value of ‘amount_title‘ is not echoing proper.

I want the value to be echoed as “I just want to pay this amount.” But it is echoing as “Ijustwanttopaythisamount.

I want the sentence with the space in between words. Plz help me to get solution.

Thanks

1 Answer 1

2

Spaces in GET parameters need to be encoded.

amount_title=<?php echo urlencode( $_REQUEST['amount_title'] ); ?>
1
  • Thanks @Milo. It works perfect. Can you tell me how to hide URL Parameters or encrypt GET Values.
    – Minu
    May 27, 2017 at 19:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.