I want a form to be processed on the same page that its on, but $_SERVER[‘PHP_SELF’] doesn’t recall the page with all the url vars in it. is there a way to do this?
@gameguy43authorApr 02.2006 — #heres my system, i haven't written much of it yet, so by all means if you see anything that could be improved, tell me:
the project:
a website where people can post/upload and view art pieces, like deviantart
the pages in question:
view.php and list.php
list.php has input fields to search for pieces by a specific artist, by a specfic format or genre, etc
view.php shows the piece
now, this may be more trouble than it's worth, but I want the view page to keep the list page's search info (maybe url vars isnt the best idea for this?). using this, I will put a "next" button that will call the list page again to find the next item in the search query and and send the user back to the view page, again with the search info stored somehow.
I would like for thisto work with cookiesturned off
now, the reason i'm workingon this right now is I want a user login system aswell. Again, tell me if you know of a better system for this than I do, but I decided to just put all of the login and logout stuff in the header file, even the form. Thus, the "log in" link calls $_SERVER['PHP_SELF'] and the header reloads the page, but with the log in form at the top. this form again calls the page its on and logs you in.
BUT WHAT IF you want to log in while viewing a piece after doing a search query from the list page. now when you hit the log in link, the page calls itself with a url var telling it to give you the login form, but NOT with the other url vars containing the search query info.
Thus i want to add the action=login url var IN ADITION to the other url vars
yet again, please tell me how this can be done better. If you have done something similar before, please help me out. I always get about this far in a project and end up dying because it just gets too complicated!
@balloonbuffoonApr 02.2006 — #To get the page name with the url variables you can either use this: [code=php]$_SERVER["PHP_SELF"]."?".$_SERVER["QUERY_STRING"];[/code] or this: [code=php]$_SERVER["REQUEST_URI"];[/code] The second option I have found to not be available in some cases, so I use the first one.
@NogDogApr 02.2006 — #I suppose it depends on why and how you're using those URL vars. You could copy them into hidden field values in the form, or save them as session variables. At least those are the first two things that jump to mind, but I'll need more details before I can give any firm recommendation.
@NogDogApr 02.2006 — #If your PHP installation is set up for using cookies to track session IDs, then you'll need to override it via a .htaccess file with the following lines: <i> </i>php_value session.use_cookies "0" php_value session.use_trans_sid "1"
Note. however, that there are some security/usability issues with this, since a user could cut-and-paste or bookmark a URL that contains the session ID.