php - Include file while passing GET Values in while loading?

887

I have a file which i created that requires you to pass in a specific key in order to load the full page, otherwise it will give you an error.

That all works great but i have another page where if you submit the form it will include the file which requires GET values, how do i go about doing this?

I tried:

include 'schedulechecker.php?key=1233key';
726

Answer

Solution:

using GET values in include is not possible include does't use an http request it just gets the contents of the file and includes it in

you can use a variable and pass using it

$key = '123key';
include 'schedulechecker.php';

if you want to use get values for that file as well

just use another variable in shedulechecker.php and assign the value after checking if$_GET['key'] exist

if(isset($_GET['key'])&& $_GET['key']!=""){
    $key =$_GET['key'];
}
985

Answer

Solution:

It is not pssible to pass your parameter usingGET withinclude You can do something like below.

$key = '123key';
include 'schedulechecker.php';

Now you can use$key in yourschedulechecker.php file.

People are also looking for solutions to the problem: php - Only send PHPSESSID in Angular 2

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.