Php variable passing help
Posted 08 September 2006 - 08:31 PM
basically I have a users page were you can view a users profile. I pass the username to the page and the users details are loaded.
so that all works. But I want to be a bit more professional with this and somehow hide the variable name. Ive seen it done on other website, but cant work out how or if it is possible to do using PHP. Basically how i want the URL to appear would be:
so the user name is passed, but you dont see the name of the page (index.php) nor the query string (?username=mrbrightside)
is this possible? - if so how?
thanks a million in advance
Posted 08 September 2006 - 08:46 PM
Posted 08 September 2006 - 08:49 PM
Posted 08 September 2006 - 08:55 PM
darn! - oh well thanks anyway :'(
Posted 08 September 2006 - 09:46 PM
I have played with .htaccess files before on another website i build, but this current one is hosted with godaddy.com, and I got a horrible feeling they dont allow you to mess with that kind of stuff.
I will investigate anyway - thanks
Posted 08 September 2006 - 09:55 PM
One, code all your variables in form elements and use $_POST['xyz'] to get them.
Two, use sessions to hold your variables and use $_SESSION['xyz'] to get them.
For either one, you'd want some sort of interface where you could set the variable, then store it by your chosen method, and display or whatever.
Two can be tricky if you're unfamiliar with session variables.
Posted 08 September 2006 - 10:04 PM
im not too bad with sessions but dont really want too many of them flying about to hold variables like this. Im looking into the mod_rewrite solution as it seems exactly what I need to do, I just hope I can get it to work with godaddy.com
Posted 08 September 2006 - 10:24 PM
A quick read through the link you suggested and a few attempts later and I got it all working!
godaddy does support mod_rewrites!
It didnt work when I tested if through the full subdomain path:
but did work through the full url:
maybe im doing something wrong in the .htaccess file, but at least it works!
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users