damdempsel Posted November 27, 2009 Share Posted November 27, 2009 Is there a way to read the end of a url and then put that into a text field? For example: damdempsel.com/message.php?username=damdempsel would have the username damdempsel in the text field. I don't want to add the data to the url, I want to get the data. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/183087-is-there-a-way-to-do-this/ Share on other sites More sharing options...
premiso Posted November 27, 2009 Share Posted November 27, 2009 You hit the nail on the head "get" data. $username = isset($_GET['username'])?$_GET['username']:''; echo $username; isset tests if the data has been set, if not the ? and : (ternary operator) is like a short if else, if it was set set $username to the get data, else set it to blank to avoid errors further down the line. Hope that helps ya. Quote Link to comment https://forums.phpfreaks.com/topic/183087-is-there-a-way-to-do-this/#findComment-966272 Share on other sites More sharing options...
damdempsel Posted November 27, 2009 Author Share Posted November 27, 2009 Thank you very much! Quote Link to comment https://forums.phpfreaks.com/topic/183087-is-there-a-way-to-do-this/#findComment-966274 Share on other sites More sharing options...
damdempsel Posted November 27, 2009 Author Share Posted November 27, 2009 Gah, how do I mark this as solved? It seems to have moved since the last time I needed it. Quote Link to comment https://forums.phpfreaks.com/topic/183087-is-there-a-way-to-do-this/#findComment-966276 Share on other sites More sharing options...
premiso Posted November 27, 2009 Share Posted November 27, 2009 Gah, how do I mark this as solved? It seems to have moved since the last time I needed it. The new forum upgrade removed that addon for now as it has to be re-coded etc. Quote Link to comment https://forums.phpfreaks.com/topic/183087-is-there-a-way-to-do-this/#findComment-966277 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.