jimsanghvi@hotmail.com Posted June 20, 2011 Share Posted June 20, 2011 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 = id ( store the id from url to varible ) Quote Link to comment https://forums.phpfreaks.com/topic/239892-read-value-from-url/ Share on other sites More sharing options...
gristoi Posted June 20, 2011 Share Posted June 20, 2011 Passing variable from page to page via the url use PHP's $_GET global variable. To assign this to a new variable: $id = $_GET['id']; $desc = $_GET['desc']; $name = $_GET['name']; Quote Link to comment https://forums.phpfreaks.com/topic/239892-read-value-from-url/#findComment-1232226 Share on other sites More sharing options...
HDFilmMaker2112 Posted June 20, 2011 Share Posted June 20, 2011 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 = id ( store the id from url to varible ) First, you could write the link simpler, with less starts and stops on php. echo '<a href="count.php?id='.$row['ID'].'&desc='.$row['PRO'].'name="abc'.$i.'">**Home**</a></li>'; Second, you use $_GET[''], with the variable in the URL you want to get, inside the brackets and single quotes. ie; $identity=$_GET['id']; $desc=$_GET['desc']; Quote Link to comment https://forums.phpfreaks.com/topic/239892-read-value-from-url/#findComment-1232227 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.