please help....php wont work!
Moderator: General Moderators
please help....php wont work!
hi, i need a bit of help!
im setting up a new website and was hoping to make the navigation dynamic...
i have set all the links on the page to something like ?L=home which would tell the page to bring up the home content (hopefully)
where i want the home content to be shown i have put
$_GET["L"]
now obviously this doesnt work because i have not put the dollar sign in there so it wont know its a tag.
i was wondering, if i wanted to turn the dynamic navigation into something that pulls content to the page where would i put the $
or is this the wrong thing to do?
please advise.
Thanks
im setting up a new website and was hoping to make the navigation dynamic...
i have set all the links on the page to something like ?L=home which would tell the page to bring up the home content (hopefully)
where i want the home content to be shown i have put
$_GET["L"]
now obviously this doesnt work because i have not put the dollar sign in there so it wont know its a tag.
i was wondering, if i wanted to turn the dynamic navigation into something that pulls content to the page where would i put the $
or is this the wrong thing to do?
please advise.
Thanks
- thomas777neo
- Forum Contributor
- Posts: 214
- Joined: Mon Mar 10, 2003 6:12 am
- Location: Johannesburg,South Africa
Ok, I think you’re a bit confused regarding the basic syntax of php.
The $_GET that you are referring to, is to GET the variable value in the URL.
e.g.
http://localhost/my_site/navigation.php?page=home
On the navigation page, if you echoed $_GET['page'], the value would be home.
So if you wanted to load pages according to that variable, you could require them using:
Have a look at the PHP manual; all of the concepts are there.
The $_GET that you are referring to, is to GET the variable value in the URL.
e.g.
http://localhost/my_site/navigation.php?page=home
On the navigation page, if you echoed $_GET['page'], the value would be home.
So if you wanted to load pages according to that variable, you could require them using:
Code: Select all
require($_GET['page'].".php"); // this will load the home.php page, referring to the exampleis there another way?
do you know if there is any way of using the $_GET["whatever"] synax to be part of a tag?
all i really need to do is get the dollor sign infront of the $_GET and it should work. if you know of a way i would be very greatfull....
Thanks
all i really need to do is get the dollor sign infront of the $_GET and it should work. if you know of a way i would be very greatfull....
Thanks
Re: is there another way?
I really dont know what you mean by that!bestm8ts wrote:all i really need to do is get the dollor sign infront of the $_GET and it should work. if you know of a way i would be very greatfull....
Can you explain yourself better please
on my website i have set all my links to index.php?L=home (the page replaces home)
i have a tag called $home that has the home content attatched and the same for other keywords like contact....
what i need to do is get from the ?L=home in the name to <? print $home ?> so i can pull the content to the page.
please help if you can but if its impossible please let me know so i can give up trying.
my goal is to create a website that is totally dynamic and all located in one file.
Thanks
i have a tag called $home that has the home content attatched and the same for other keywords like contact....
what i need to do is get from the ?L=home in the name to <? print $home ?> so i can pull the content to the page.
please help if you can but if its impossible please let me know so i can give up trying.
my goal is to create a website that is totally dynamic and all located in one file.
Thanks
do it like this, variable variables is what you are lookign for
Code: Select all
echo ${$_GET["L"]};
Last edited by JayBird on Fri May 05, 2006 4:25 am, edited 1 time in total.
- thomas777neo
- Forum Contributor
- Posts: 214
- Joined: Mon Mar 10, 2003 6:12 am
- Location: Johannesburg,South Africa
Honestly, your concept of php is incorrect.
My basic example should be adequate.
Regarding the tags, php is embedded into html. So you could simply echo it inside the html.
example not related to your issue:
My basic example should be adequate.
Regarding the tags, php is embedded into html. So you could simply echo it inside the html.
example not related to your issue:
Code: Select all
<a href="<?php echo $_GET['whatever'].".php"; ?>">Open the whatever page</a>