jimfog Posted January 9, 2012 Share Posted January 9, 2012 Look at the following code: echo '<a href="'.$_SERVER["PHP_SELF"]. "?month= ". $prev_month ." &year= " .$prev_year. '"> This code sends data through the URL and a REQUEST variable is standing by to process them.So far nothing strange. I do not understand though where it is used the ? before the month word? What is its usefulness? I do not think here we are dealing with the ternary operator, unless there would be a colon somewhere. Link to comment Share on other sites More sharing options...
justsomeguy Posted January 9, 2012 Share Posted January 9, 2012 That's printing the question mark as part of the URL. It's part of the string to print, it's not a PHP operator. Link to comment Share on other sites More sharing options...
jimfog Posted January 9, 2012 Author Share Posted January 9, 2012 Why do we use it as part of the URL? Can it be omitted? I did but i get the usual page "object not found". Link to comment Share on other sites More sharing options...
justsomeguy Posted January 9, 2012 Share Posted January 9, 2012 The question mark separates the file name from the query string. You can't omit it if you have a query string, because then everything is part of the file name. Link to comment Share on other sites More sharing options...
jimfog Posted January 9, 2012 Author Share Posted January 9, 2012 Now i got it. Thanks Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.