Are you also making such a website in which you have to get any value from the URL, that too without using the method with $_GET[‘name’] then how can you find the value from the link of the website,

today we will this video I am going to know, Request string without GET arguments [duplicate].

How to get Value from url in php without get method

To get the Add value to your website URL without using $_GET parameters, see below for how you can get the value

 

Create index.php File for this code

<?php
$siteURL_OIC = "Your Website URL"; 
      $con = mysqli_connect('localhost','Username','Password','DB_Name');
$urlSelect = "https://";


$country_name = userInput_OIC($_GET['country_name']);
$state_name = userInput_OIC($_GET['state_name']);
$district_name = userInput_OIC($_GET['district_name']);
$town_name = userInput_OIC($_GET['town_name']);
 ?>
/*In which URL you have to fix in advance that the first URL will be of Country, the second which will be the value in the URL will be that of State, so you have to fix it in advance, for this you will have to create a file with .htaccess*/

 <script>
                function sendAction_OIC() {
                    formAction = document.OICifscform.bank[document.OICifscform.bank.selectedIndex].value;
                    document.OICifscform.action = formAction;
                    document.OICifscform.submit();
                }

                function resetAction_CC() {
                    document.location.href = "<?php echo $siteURL_OIC; ?>";
                }
            </script>
<?php
error_reporting(0);
$cWith = "code";

function currentUrl_OIC() {
    return (($_SERVER['HTTPS'] == "on") ? "https" : "http") . "://" . $_SERVER[HTTP_HOST] . parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
}


$oWith = "online";
// -- common function
function url_string($OIC) {
	return strtolower(str_replace(' ', '-', $OIC));
}

function userInput_OIC($OIC) {
	global $con;
	return strtoupper(str_replace("-", " ", mysqli_real_escape_string($con, trim($OIC))));
}

?>

If you want to convert any String to URL then

<?php echo url_string("my name is coding help"); ?>

Then you will get the name my-name-is-coding-help printed in the Output

 

You have to create a file with .htaccess in the same folder where your website’s Index.php file is.



Options -Indexes -MultiViews

<files *.html>
SetOutputFilter DEFLATE
</files>


Options +FollowSymLinks
RewriteEngine on


RewriteRule ^index.html$ index.php [L]
RewriteRule ^search.html$ search.php [L]

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.+) - [PT,L]


RewriteRule ^(.*)/(.*)/(.*)/(.*)/?$ index.php?country_name=$1&state_name=$2&district_name=$3&town_name=$4 [QSA]
RewriteRule ^(.*)/(.*)/(.*)/?$ index.php?country_name=$1&state_name=$2&district_name=$3 [QSA]
RewriteRule ^(.*)/(.*)/?$ index.php?country_name=$1&state_name=$2 [QSA]
RewriteRule ^(.*)/?$ index.php?country_name=$1 [QSA]

Here you have to fix whatever value you have to set first, then with what name you have to set the second, then you set the name here in index.php file to userInput_OIC($_GET[‘country_name’ ]); You can gate the value from code

 

.htaccess with HTTP ERROR 500 erro

If you run the file without Database Implementation, then you will get the following error, if you want to get the value from the URL without using the database, then you have to $_GET[”]; You can use the method, the name you will enter in it, you enter the value of the name you had set in .htaccess and enter the value here.

<?php echo $_GET['country_name']; ?>

this code use in index.php file

Leave a Reply

Your email address will not be published. Required fields are marked *