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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.