I'm trying to get the format of Date/Time from the URL with the $_GET and put it into a input field:
This is the format: 09/11/2019 14:48 CDT 09/11/2019 14:48 CDT
$stime = "09/11/2019 14:48 CDT 09/11/2019 14:48 CDT";
$etime = "";
This is part of the code when the form is submitted:
includes/connect.inc.php
if (empty($stime) || empty($etime)) {
header("Location: ../home.php?error=emptyfields&stime=".rawurlencode($stime)."");
exit();
}
This is the code where the form/input fields are:
home.php
if (isset($_GET['error'])) {
$stime = ($_GET['stime']);
}else {
$stime = "";
}
<form method="post" action="includes/connect.inc.php" enctype="multipart/form-data">
<li>Start Time : <input type="text" name="stime" id="dato8" value=<?php echo rawurldecode($stime); ?> ></li>
<input type="submit" value="Submit" class="button">
</form>
All works fine but the string that returns to the input field is just: "09/11/2019", missing the rest of the original string.
Any idea of what am i doing wrong?
I did a test in a separate file with this code:
<?php
$dateDecoded = "09%2F11%2F2019%2014%3A48%20CDT%2009%2F11%2F2019%2014%3A48%20CDT";
$dateToEncode = "09/11/2019 14:48 CDT 09/11/2019 14:48 CDT";
echo rawurldecode($dateDecoded);
echo "<br>";
echo rawurlencode(dateToEncode);
?>
And works perfect, does the result i'm looking for, this is the output of the above test:
09/11/2019 14:48 CDT 09/11/2019 14:48 CDT
09%2F11%2F2019%2014%3A48%20CDT%2009%2F11%2F2019%2014%3A48%20CDT
Thanks in advance.
Diego