Hi, i am a beginner learner of PHP. i come across this link to a php script: <a=href="hello.php?name=Michael">Michael</a> I wonder what does the whole link structure means" hello.php is the file name. what is the "?" doing there? Anyone can advise? Thanks.
The "?" indicated the query string that is being passed to the php page. The information that follows will be name=value pairs, seperated by "&". Inside the PHP script, you can access them through the $_GET superglobal.
Try it out for yourself: index.php // index.php?somevar=somevalue&somearray[]=othervalue&and=so+on var_dump($_GET); PHP:
hei, its <a href="hello.php?name=Michael">Michael</a> <a> id for anchor tag --- for setting hyperlink , so while clicking this it will get redirected to hello.php pahe with an argument name-Michael ? -- is used for appending the arguments with the page, here we are passing the name as get parameter along with the hyperlink page. second argument owards we will be using an & sign for appending it to the url. Hope this answers your question!
yes, thank you and to all others too. However, I have always wonder what is the term "argument" in php means. Why is it called an "Argument"? Argument to me is having a verbal war with another person. hehe.
some developers get pissed off by php easily argument in tech-related: 'a reference or value that is passed to a function, procedure, subroutine, command, or program'
ok, so that means $big = "you are sexy"; "you are sexy " is considered an argument to $big. Is that right?
No - "you are sexy" is the value of the variable $big. However - in this scenario; $big = "you are sexy"; myfunction($big); function myfunction($var) { print $var; } PHP: Here, The value in $big is passed as an argument to 'myfunction'.