9 Replies - 1551 Views - Last Post: 17 March 2013 - 07:40 AM Rate Topic: -----

#1 josefroyadvincula  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 23
  • Joined: 23-December 12

header location with a '?somevariable==true' - what are they c

Posted 16 March 2013 - 07:57 AM

Well I've come accross a sample login form. Going through the code, there's a line that looks like

header("location: index.php?login_failed==true");


I was wondering, what are they called? I mean, are they functions (soooooooooo probably not)?
Is This A Good Question/Topic? 0
  • +

Replies To: header location with a '?somevariable==true' - what are they c

#2 laytonsdad  Icon User is online

  • Cheese and Sprinkles
  • member icon

Reputation: 429
  • View blog
  • Posts: 1,813
  • Joined: 30-April 10

Re: header location with a '?somevariable==true' - what are they c

Posted 16 March 2013 - 08:55 AM

What you see is a header request to load index.php with login_failed being a GET variable passed with the value of TRUE.

It would be retrieved by using $_GET['login_failed'] to get the value.

This post has been edited by Dormilich: 16 March 2013 - 05:54 PM

Was This Post Helpful? 2
  • +
  • -

#3 StefanOnRails  Icon User is offline

  • D.I.C Head

Reputation: 35
  • View blog
  • Posts: 105
  • Joined: 31-July 12

Re: header location with a '?somevariable==true' - what are they c

Posted 16 March 2013 - 09:14 AM

View Postlaytonsdad, on 16 March 2013 - 05:55 PM, said:

What you see is a header request to load index.php with login_failed being a GET variable passed with the value of TRUE.

Actually $_GET["login_failed"] would contain "=true" since he's passing two "=" instead of one.
Was This Post Helpful? 2
  • +
  • -

#4 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6036
  • View blog
  • Posts: 23,422
  • Joined: 23-August 08

Re: header location with a '?somevariable==true' - what are they c

Posted 16 March 2013 - 09:51 AM

The actual term for this is a query string.
Was This Post Helpful? 0
  • +
  • -

#5 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3197
  • View blog
  • Posts: 10,724
  • Joined: 12-December 12

Re: header location with a '?somevariable==true' - what are they c

Posted 16 March 2013 - 11:59 AM

What's to stop me typing the following into the address bar?

index.php?login_failed==false
// or
index.php?login_failed=false

I think query-strings should be used to pass insignificant details between pages, such as a page number (for pagination) or the currently viewed product-id, etc. Something like 'login_failed' as a parameter would make me a little nervous.
Was This Post Helpful? 2
  • +
  • -

#6 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6036
  • View blog
  • Posts: 23,422
  • Joined: 23-August 08

Re: header location with a '?somevariable==true' - what are they c

Posted 16 March 2013 - 12:00 PM

Another really shitty PHP/MySQL tutorial, no doubt. There's no shortage of them.
Was This Post Helpful? 0
  • +
  • -

#7 josefroyadvincula  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 23
  • Joined: 23-December 12

Re: header location with a '?somevariable==true' - what are they c

Posted 16 March 2013 - 09:46 PM

laytonsdad

Well, yes, there was

if ( isset($_GET['login_failed'] == true) )


But, why GET? I mean, is there any difference if it was POST?



andrewsw

A very good point



JackOfAllTrades
LOL, it was a tutorial. I'm actually studying creating a login page using PHP and MySQL. SOOOO AFTER THE POINTS ABOVE, I GUESS I SHOULD START LOOKING FOR ANOTHER ONE?
Was This Post Helpful? 0
  • +
  • -

#8 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6036
  • View blog
  • Posts: 23,422
  • Joined: 23-August 08

Re: header location with a '?somevariable==true' - what are they c

Posted 17 March 2013 - 03:18 AM

Here's a good one.
Was This Post Helpful? 1
  • +
  • -

#9 andrewsw  Icon User is online

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3197
  • View blog
  • Posts: 10,724
  • Joined: 12-December 12

Re: header location with a '?somevariable==true' - what are they c

Posted 17 March 2013 - 03:30 AM

View Postjosefroyadvincula, on 16 March 2013 - 09:46 PM, said:

Well, yes, there was

if ( isset($_GET['login_failed'] == true) )


But, why GET? I mean, is there any difference if it was POST?

GET reads the values at the end of the address-line; POST doesn't, it reads values that are posted (method="POST") during a form submission. But the distinction between GET and POST is fundamental to PHP so you need to continue, or re-start, your studies.
Was This Post Helpful? 0
  • +
  • -

#10 josefroyadvincula  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 23
  • Joined: 23-December 12

Re: header location with a '?somevariable==true' - what are they c

Posted 17 March 2013 - 07:40 AM

JackOfAllTrades

Thanks! Interesting methods there. Will definitely try it!


andrewsw

Hmmm... Not sure I understood that, lol... Will definitely keep reading. Thanks!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1