Reputation: 7211
I have this PHP code --
<?php include('res/scripts/php/content_type/form_contents/birth_date_form.php?type=register&query=birth_month'); ?>
As you can see I'm including ?type
and &query
in it, so is it wrong or there is something else which going wrong. Because it shows me the following error---
Warning: include(res/scripts/php/content_type/form_contents/birth_date_form.php?type=register&query=birth_month) [function.include]: failed to open stream: No error in C:\xampp\htdocs\mysharepoint\1.1\res\scripts\php\content_type\register_form.php on line 82
Warning: include() [function.include]: Failed opening 'res/scripts/php/content_type/form_contents/birth_date_form.php?type=register&query=birth_month' for inclusion (include_path='.;\xampp\php\PEAR') in C:\xampp\htdocs\mysharepoint\1.1\res\scripts\php\content_type\register_form.php on line 82
But after removing ?type=register&query=birth_month
, I get no errors!
So do you have any suggestions on this, please let me know.
Thanks in advance!
Upvotes: 1
Views: 823
Reputation: 1942
PHP is going to look for the file name 'birth_date_form.php?type=register&query=birth_month' which does not exist.
You can pass the variables to your script using in the called url directly, and call birth_date_form.php instead.
That should work.
Upvotes: 1
Reputation: 270677
You cannot include a URL with query string via relative path. If you need to specify the query string, do it as a full absolute URL:
include('http://www.example.com/res/scripts/php/content_type/form_contents/birth_date_form.phptype=register&query=birth_month');
This requires allow_url_fopen
to be on.
Upvotes: 3
Reputation: 58581
You are trying to include as if it is served via the web, but include will simply load the local file - so there is no query string as no processing takes place
Furthermore - if you are trying to get an external url to be output from your script, you could do something like this:
echo implode(file('http://localhost/res/scripts/php/content_type/form_contents/birth_date_form.php?type=register&query=birth_month'))
Upvotes: 7