In the fourth edition of PHP & SQL Novice to Ninja there is a line of code
<p><a href = "?addjoke">Add your own joke</a></p>
I cannot find any reference to the construct “?addjoke” anywhere in the literature. What happened to html between the fourth and fifth editions of Kevin Yank’s book (ie between 2012 and 2017)? And where can I find details of this construct?
I don’t know what happened to the line of code, but here it is again
````
<a href"?addjoke">Add your joke</a></p> I cannot find the construct"?addjoke" anywhere in the literature. What happened to html between the fourth and fifth editions of Kevin Yank’s book (ie between 2012 and 2017). And where can I find details of the construct?`
Yank, Kevin. PHP & MySQL: Novice to Ninja, 5th. Edition (Build Your Own Database Driven Website Using PHP & MySQL) (p. 120). SitePoint Pty Ltd. Kindle Edition.
Yank, Kevin. PHP & MySQL: Novice to Ninja, 5th. Edition (Build Your Own Database Driven Website Using PHP & MySQL) (p. 120). SitePoint Pty Ltd. Kindle Edition.
Yank, Kevin. PHP & MySQL: Novice to Ninja, 5th. Edition (Build Your Own Database Driven Website Using PHP & MySQL) (p. 120). SitePoint Pty Ltd. Kindle Edition.
The “?addjoke” is a query string in the url. There are a lot of different flavors of the url, and this is one of them (see https://url.spec.whatwg.org/#urls for the spec). So by not specifying a domain and page like http://www.example.org/page, the browser uses the default current domain and page as the location, but by adding “?stuff here” the question mark is the beginning of a query string, which is then passed to the page for processing. So basically the page will get refreshed, and it’s up to the page to do something with the string “addjoke” in this case.
It may well be that the .htaccess file is processing that string, too. If you post in the PHP section of the board, I believe one of the contributors to that book is on there from time to time.