<?php
$encodedUrl='';
$decodeddUrl='';
if(isset($_POST['encode']) && isset($_POST['url_to_encode']) )  $encodedUrl=urlencode($_POST['url_to_encode']);
if(isset($_POST['decode']) && isset($_POST['url_to_decode']) )  $decodeddUrl=urldecode($_POST['url_to_decode']);
?>
<br>

<form method="post">
    <input type="text" name="url_to_encode" >
    <input type="submit" name="encode" value="Encode">
    <span><?php echo $encodedUrl; ?></span>
</form>
<br>
<form method="post">
    <input type="text" name="url_to_decode" >
    <input type="submit" name="decode" value="Decode">
    <span><?php echo $decodeddUrl; ?></span>
</form>