1

Hello i am new to PHP and was wondering if you could use the $_GET method without the data= for example.

www.mydomain.co.uk/?dataiwanttoget

Instead Of

www.mydomain.co.uk/?data=dataiwanttoget

Any help would be appreciated im a beginner at PHP, so i am sorry if this does not make much sense.

4
  • impossible, data is the key in $_GET array Commented Dec 8, 2015 at 11:55
  • 1
    Its not impossible... It can be done in several ways, eg. by htaccess, or by as mentioned by @Marc in his answer. Commented Dec 8, 2015 at 11:59
  • $_SERVER['QUERY_STRING'] will contain what you are looking for. Commented Dec 8, 2015 at 12:09
  • @Sanchit you are right, sorry I have a long day and isnt thinking very straight :( Commented Dec 8, 2015 at 12:25

1 Answer 1

4

Yes, of course. To just get the string after the ? you can use PHP's key() function:

$value = key($_GET);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.