PHP includes problem

First time using PHP inlcude on my projects. I want to include a file with a query string.

<?php include 'gt_settings.php?part=head'; ?>

I get this error

**Warning** : include(gt_settings.php?part=head): failed to open stream: No such file or directory in  **/Volumes/Bycom/Websites/solanaweb/www/index.php**  on line  **9**

**Warning** : include(): Failed opening 'gt_settings.php?part=head' for inclusion (include_path='.:/usr/local/Cellar/php/7.4.4/share/php/pear') in  **/Volumes/Bycom/Websites/solanaweb/www/index.php**  on line  **9**

I think query string is the problem. Any help will be welcome.

Thanks in advance.

Hey Juan,

May I ask what the reason is for that?

Anyway, I think you should just include the php file (no query string) and inside it (gr_settings.php) check for the query string

1 Like

I want to put inside php the google tags settings. I could solve in different files includes. I want to put where is the head the head code and where is de body the body color.

I have been using includes wrong for a long way.

I solve with another method

$_GET['id']=$somevar;
include('myFile.php');

Thanks.

If I understand correctly you want to include 2 (or more) files in your page…
You can do that directly.
Make a “inc_head.php” and another “inc_body.php” and include them wherever and whenever you need to.

Yes but I want to concentrate all tags in a single document. I know that two documents is easier. Thanks a lot.