Page 1 of 1

I am stuck using include () function

Posted: Tue Sep 02, 2003 1:11 am
by harsha
I have created two pages

index.php

this page is the main page. and i have included

include(jawab.php?a=default) in this page

---------------------------------------------
jawab.php
in this page i have used
$_SERVER["PHP_SELF"];
in the anchor tag

I have the problem here.

when i click the anchor in the index.php the jawab.php is not opening in freshly instead it is opened there it self.

and the $_SERVER["PHP_SELF"] is taking value
index.php instead of jawab.php when include as mentioned above.

how can i overcome this problem.

Try This Instead

Posted: Tue Sep 02, 2003 2:12 am
by thomas777neo
Hi

First of all I don't think you can send variables through the include statement. To get around this you could do this:

Code: Select all

$a="default";

include("whatever.php"); //note the syntax
(this would automatically include the $a variable)

But you wanted the page you include to open freshly, thus you could use the header function.

Code: Select all

$header = "Location: http://localhost/your_site/whatever.php?val=" . $val . "&reportname=" . $reportname. "&parm=" .$parm;
header("$header");
This should work a bit better

Cheers 8)

Re: I am stuck using include () function

Posted: Tue Sep 02, 2003 4:31 pm
by m3rajk
harsha wrote:I have created two pages

index.php

this page is the main page. and i have included

include(jawab.php?a=default) in this page

---------------------------------------------
jawab.php
in this page i have used
$_SERVER["PHP_SELF"];
in the anchor tag

I have the problem here.

when i click the anchor in the index.php the jawab.php is not opening in freshly instead it is opened there it self.

and the $_SERVER["PHP_SELF"] is taking value
index.php instead of jawab.php when include as mentioned above.

how can i overcome this problem.
$_SERVER[PHP_SELF] is working perfectly. it's your understanding of it that is the issue.

it can only refer to the page that it is in.

same thing with your include issuetry bookmarking http://www.php.net

the seardch function feature should have explained the include issue

Posted: Tue Sep 02, 2003 11:03 pm
by harsha
Thank you very much i fixed the problem the script works fine and perfect.

harsha