Jump to content

Recommended Posts

No, because you would just define the variable instead.

 

$_GET['sn'] = 1; // or $sn = 1; however it is coded
include 'order.php';

 

Would work, reason being. You are including the script and not executing it. If you want it to execute you can use file_get_contents to execute it then echo the output, but you would have to use the full URL.

Link to comment
https://forums.phpfreaks.com/topic/184305-include/#findComment-973008
Share on other sites

no.  include() is simply, well, including the code from the respective file.  the statement does not execute/parse/etc., the code as a browser would if using the $_GET superglobal in the URL or something along those lines.

 

it's used just to include a file so that the respective code/script is made available to the parent script/file.

 

you could look into several functions that might (or might not work) in this case to accomplish such a task:

 

curl, file_get_contents, fopen, just to name a few.

 

EDIT: or do as premiso's first post there suggested.

Link to comment
https://forums.phpfreaks.com/topic/184305-include/#findComment-973014
Share on other sites

Oddly enough it is not reading 90% of the variables... It is correctly still able to access that get variable but it is not able to read regular variables... any idea for why this is? The code that declares the variables is included next to the include of the same code that tries to read it...

Link to comment
https://forums.phpfreaks.com/topic/184305-include/#findComment-973017
Share on other sites

there is no reason those variables can't be accessed from one include file to the other.  once a file is included, it is as if that code is embedded directly on the page.

 

show code on how you are declaring variables and how they are being used in the included file(s).

Link to comment
https://forums.phpfreaks.com/topic/184305-include/#findComment-973028
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.