.../whatever.php?=somthing
I know it has to do with variables, but being new to php, I know not how to do the above. Anything reguarding procedure / syntax would be appreciated
thanks
I think you mean whatever.php?something as people sometimes do this (not sure why...) but anyway just do the following in whatever.php
echo $_SERVER['QUERY_STRING'];
Alot of times people use it to pass a var. Like
if($page==about) { echo"You are looking at our $page page." echo"My Email is [email]hobbit@hobbit.com[/email] Please do not spam me"; } else if($page==main) { Hi. You are on our $page page. <a href=\"$PHP_SELF?page=about\">click here</a> to view the about page. }
I may have misread, I thought you wanted ?foo instead of the standard ?foo=bar method. If you aren't wanting ?foo specifically then it's easy. Read this manual page:
http://www.php.net/variables.external
Note that the stuff in the URL is method GET (the stuff after the ? is also known as the QUERY_STRING) so in our ?foo=bar example you would simply do echo $_GET['bar'] If you mean something else I'm sure someone will help you.
<?php if($page==about) { echo"You are looking at our $page page."; echo"My Email is hobbit@hobbit.com Please do not spam me"; } else if($page==main) { Hi. You are on our $page page. <a href="$PHP_SELF?page=about/">click here</a> to view the about page. ; } ?>
<?php
if($page==about) {
echo"You are looking at our $page page."; echo"My Email is hobbit@hobbit.com Please do not spam me";
}
else if($page==main) {
Hi. You are on our $page page. <a href="$PHP_SELF?page=about/">click here</a> to view the about page. ;
?>
This is what Im looking for, but I get a parse error on line 14. However I am not skilled enough to check syntax ect. Help please
What you are talking about is a simple method of appending a variable onto a URL, usually used in links.
whatever.php?myvar=5&yourvar=7
would pass the values:
$myvar = 5; $yourvar = 7;
to the page "whatever.php".
It's about that simple.
Originally posted by coppercoins What you are talking about is a simple method of appending a variable onto a URL, usually used in links. whatever.php?myvar=5&yourvar=7 would pass the values: $myvar = 5; $yourvar = 7; to the page "whatever.php". It's about that simple.
Not quite; these days it's considered more appropriate to use the variables $GET['myvar'] and $GET['yourvar'], since (in any decently secured system) $myvar and $yourvar will not be set.
i need a book
Find a tutorial on the Web, and read the PHP Manual on php.net