0

I want to create a redirect in PHP where I want to pass + sign as %2B in URL but whenever, I'm using header("Location: url ") . It is passing the + sign as +, So at the end server, after decoding it is showing a blank space instead of showing + sign.

<?php

    echo $eqn=$_GET['eqn'];
    $ord=$_GET['ord'];

    

    header("Location: http://example.com/$eqn")
?>

Basically, I've created a HTML form where I am passing data to the following php page, Here I want to redirect to a url like http://example.com?i0=encoded-value-required/aa. And here in the encoded-value-required parameter, I want to pass the + sign as %2B in the header location.

1

1 Answer 1

0

Like ADyson wrote you should use urlencode.

$eqn = urlencode($_GET['eqn']);
Sign up to request clarification or add additional context in comments.

1 Comment

Is this advice duplicated ANYWHERE on Stack Overflow before today? If so, please close as a duplicate instead of answering.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.