Pretend there's a website.
http://example.com/donate
Then you click a link and bam it turns into
http://example.com/donate?id=1 How would I get the ?id=1 in my webpages like that?
What I want to do is have a user click on a link in a page, and have another page show up while on the same exact URL, and I would like it to show like a ?id=1 or something along those lines. How would I go about doing this?
You set that information in the HTML like
<a href="example.com/donate?id=1">Click Me</a>
When that script runs you see what id
was set to by quizzing the $_GET
array like so
<?php
if ( isset($_GET['id'] ) {
// do something with it
}
see Variables From External Sources in the PHP manual.
The part after the ? is called query string. And the name=value pairs (like e.g. id=1) are the parameters of a GET request.