proud Posted January 20, 2010 Share Posted January 20, 2010 Hello everyone, I want to use $_GET to retrieve a value from a URL. Now, the problem is that I have 2 values that I want to get from the following URL: http://localhost/library/title_info.php?book=My Book_student=mike The values that I want to get are: My Book, and mike .. Now, I know that its easy to get the last value by the following code for example: $get=$_GET['student']; which will give me the value: mike.. But the problem is how can i get the value of book which is: My Book? Because if I tried: $get=$_GET['book']; The value of $get would be: My Book_student=mike Put in consideration that I want "My Book" only and not the rest of the URL after it.. So is there someway to omit the rest of the string starting from the under score "_" , or is there any other way to accomplish this? Link to comment https://forums.phpfreaks.com/topic/189107-help-with-getting-a-value-from-a-url/ Share on other sites More sharing options...
co.ador Posted January 20, 2010 Share Posted January 20, 2010 you have to append it using "&". like http://localhost/library/title_info.php?"book='$_GET['book']. '&student='. $_GET['student']; something like that! Link to comment https://forums.phpfreaks.com/topic/189107-help-with-getting-a-value-from-a-url/#findComment-998380 Share on other sites More sharing options...
proud Posted January 20, 2010 Author Share Posted January 20, 2010 Yes that does the job! Thanks a lot co.ador Link to comment https://forums.phpfreaks.com/topic/189107-help-with-getting-a-value-from-a-url/#findComment-998384 Share on other sites More sharing options...
co.ador Posted January 20, 2010 Share Posted January 20, 2010 you are welcome! Link to comment https://forums.phpfreaks.com/topic/189107-help-with-getting-a-value-from-a-url/#findComment-998386 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.