Thursday, July 30, 2020

how to solve get multiple parameters with same name from a URL in PHP

<!DOCTYPE html>
<html>
<body>

<?php
$str = "query%5Bquery%5D%5Bquery%5D%5Bquery%5D%5Bquery%5D%5Bdate%5D=2020-07-31&query%5Bquery%5D%5Bquery%5D%5Bquery%5D%5Bquery%5D%5Btime%5D=07%3A30&query%5Bquery%5D%5Bquery%5D%5Bquery%5D%5Bquery%5D%5Bend_time%5D=16%3A30";
echo"<pre>";
print_r (explode("&",$str));
$get_data = explode("&",$str);
echo"<br>";
print_r (explode("=",$get_data[0]));
echo"<br>";
$get_date = (explode("=",$get_data[0]));
echo "OUTPUT Date:-" . $get_date[1];
echo"<br>";
echo"<br>";
echo"<br>";
print_r (explode("=",$get_data[1]));
echo"<br>";
$get_start_time = (explode("=",$get_data[1]));
echo "OUTPUT Time:-" . urldecode($get_start_time[1]);
echo"<br>";
echo"<br>";
echo"<br>";
print_r (explode("=",$get_data[2]));
echo"<br>";
echo"<br>";
echo"<br>";
$get_end_time = (explode("=",$get_data[2]));
echo "OUTPUT End Time:-" . urldecode($get_end_time[1]);
echo"<br>";
echo"<br>";
?>

</body>
</html>

No comments:

Post a Comment

If you have any problem please let me know.