Read Value from URL in PHP
I have a link on Home Page say for eg
<a href="count.php?id=<开发者_运维知识库?php echo $row['ID']; ?>&desc=<?php echo $row['PRO']; ?>" name="abc<?php $i; ?>">**Home**</a></li>
Once click on Home Link provided above it goes to next page that is
http://abb/MyWeb/pr/arro/count.php?id=4&desc=It%20isavailable
Now I want to read value from URL
id=4
and
desc=it is available
and I want to store it in variable
$idenity = id1
( store the id from url to variable )
Is this what you want?
$identity=$_GET['id'];
$identity = $_GET['id'];
$desc = $_GET['desc'];
Make sure that you filter the contents of the $_GET array to avoid vulnerabilities. For instance, if id
is supposed to be a number, force it:
$identity = (int)$_GET['id'];
精彩评论