doddsey_65 Posted June 4, 2010 Share Posted June 4, 2010 i have a page called tutorials.php. When a user clicks one of the displayed tutorials they are sent to tutorials.php?id=thetutorialid thetutorial id is taken from the database column id. however i want it to look something like tutorials.php?name=tutorialname i thought of changing the $_GET['id'] to $_GET['tutorialname'] but it didnt work. I also changed the hyperlink from tutorials.php?id=<? echo $id; ?>"> to tutorials.php?name=<? echo $tutorialname; ?>"> Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/203873-_get/ Share on other sites More sharing options...
syed Posted June 4, 2010 Share Posted June 4, 2010 Did you change your sql? Quote Link to comment https://forums.phpfreaks.com/topic/203873-_get/#findComment-1067767 Share on other sites More sharing options...
bugcoder Posted June 4, 2010 Share Posted June 4, 2010 I would suggest that you use id instead of name and you can handle www.xyz.com/productName by .htaccess file and that will be good too from search engine optimisation point of view. For .htaccess usage search "url rewriting tutorials" and you will find many. Quote Link to comment https://forums.phpfreaks.com/topic/203873-_get/#findComment-1067772 Share on other sites More sharing options...
micah1701 Posted June 4, 2010 Share Posted June 4, 2010 if you just want to change the URL from ?id= to ?name= then all you need to do in your PHP code is change $_GET['id'] to $_GET['name'] or am I not getting what you're trying to do? Quote Link to comment https://forums.phpfreaks.com/topic/203873-_get/#findComment-1067776 Share on other sites More sharing options...
doddsey_65 Posted June 4, 2010 Author Share Posted June 4, 2010 i did change it to get name but it didnt work. I think i will go for the rewrite thing cos i was doing this for SEO anyway. Quote Link to comment https://forums.phpfreaks.com/topic/203873-_get/#findComment-1067783 Share on other sites More sharing options...
doddsey_65 Posted June 4, 2010 Author Share Posted June 4, 2010 okay my host doesnt allow .htaccess so i need something different. like i said i changed if (isset($_GET['id'])) to if (isset($_GET['tutorialname'])) and changed <a href="tutorials.php?id=<?php echo $row->id; ?>"> to <a href="tutorials.php?name=<?php echo $row->tutorialname; ?>"> but its not working, the content doesnt show up when the page loads. Quote Link to comment https://forums.phpfreaks.com/topic/203873-_get/#findComment-1067792 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.