0

I am having issues trying to call a php script from another php script with an include. I am passing "keysum" as a variable and have verified that is the case. The include statement is failing with the following error. I am pretty new to php and need to call different programs one for warehouse summary and one for account summary based on the radio button selected.

PHP Warning: include failed to open stream: No such file or directory referer:

PHP Warning: include(): Failed opening

As you see from my code below I have tried many different ways of doing the path.

Here is the include statement loop.

if($_POST['xltype'] == 'keysum') {
6
  • 1
    Perhaps you want file_get_contents() or similar instead? include is for local files on the same server. Commented Oct 24, 2018 at 20:31
  • These are all on the same server but for some reason it is not finding the program. I've tried it with the path in the include and without. Commented Oct 24, 2018 at 20:35
  • includekeyacctspread.php with out the ? ... your saying fthe file name is keyacctsum.php?cust=001990R00 when its not Commented Oct 24, 2018 at 20:38
  • If you want to pass a value through your include, set a variable before you include the file and reference that in the other script. If its not including, and giving you warnings - the path is wrong and you must use the right one. :-) Commented Oct 24, 2018 at 20:41
  • Thank you very much I used $_REQUEST['cust'] = $cust; then the include "keyacctspread.php"; and that worked great. Commented Oct 24, 2018 at 20:50

1 Answer 1

0

You can't include a query string in an include() php won't let you.

If it's two separate servers, you should not be using includes anyway.

This question is answered here: URL querystring with a php include

Sign up to request clarification or add additional context in comments.

1 Comment

You can use a query string if you include from HTTP(s), but not from the filesystem.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.