I have a need to call index.php with some variables from another file
Like index.php/?cat=18
I have tried an include and this did not work.
From what I understand I need a block variable
I am looking for some sample code if anyone knows how to do this
call index.php with variables
Moderator: General Moderators
Re: call index.php with variables
Actually, that would be index.php?cat=18. You have an extra slash in there.
Have you though about using sessions?
What happened when you tried to use an include?
Post some code and any error messages.
Have you though about using sessions?
What happened when you tried to use an include?
Post some code and any error messages.
Re: call index.php with variables
I am using this almost exactly on another site
Except for the second line which on the other site needs no URL Variable. Because it does not work on this site I looked around on the web and found various references to this inability to pass url variables this way in an include.
the error is that it can not open that file / stream
Except for the second line which on the other site needs no URL Variable. Because it does not work on this site I looked around on the web and found various references to this inability to pass url variables this way in an include.
Code: Select all
<?php include 'header.php' ; ?>
<?php include 'index.php?cat=4' ; ?>
<?php include 'footer.php' ; ?>the error is that it can not open that file / stream
Last edited by Benjamin on Tue May 18, 2010 4:39 pm, edited 1 time in total.
Reason: Added [syntax=php] tags.
Reason: Added [syntax=php] tags.
Re: call index.php with variables
It sees ?cat=4 as part of the file name.
Check out this URL, it will probably work for you: http://inkgrass.lazymoon.org/2007/11/12 ... p-include/
Check out this URL, it will probably work for you: http://inkgrass.lazymoon.org/2007/11/12 ... p-include/
Re: call index.php with variables
Yes that worked and thanks so much!
Re: call index.php with variables
I ask my fair share of questions on here, it's nice to be able to help out someone else.