Jump to content

Help with getting a value from a URL


proud

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.