amandas Posted March 16, 2007 Share Posted March 16, 2007 Hi guys. I don't really know PHP all that well, but I have been trying all night to do the following: A user submits their URL to form and the form then redirects the user to a new url with the submitted URL. Example: User enters www.mydomain.com and then submits the form. The person is then redirected to www.mydomain.com/folder. Any ideas on how to do this? I have tried several things, but no luck. My most recent attempt was: if ( $submitme == 1 ) { $link = "http://www." .$url ."/folder"; <--- I am pretty sure that is wrong header('location:'. $link); exit; } Please don't laugh. Thanks for looking. -Amanda Link to comment https://forums.phpfreaks.com/topic/42950-please-helpneed-a-simple-code-but-i-dont-know-how-to-do-it/ Share on other sites More sharing options...
Barand Posted March 16, 2007 Share Posted March 16, 2007 Hard-coding "/folder" will only work if you know all your users' domains have a folder with that name. eg http://www.google.com/folder will give a page not found error. Also, register_globals is usually OFF by default so you have to get the $_GET or $_POST values from the form. try <?php if (isset($_GET['submit'])) { if (!empty($_GET['url'])) { $link = 'http://www.' . $_GET['url'] . '/' . $_GET['folder'] ; header ('location:' . $link) ; } } ?> <form> URL http://www.<input type='text' name='url' size='40'> / <input type='text' name='folder' size='20'><br> <input type='submit' name='submit' value='Submit'> </form> Link to comment https://forums.phpfreaks.com/topic/42950-please-helpneed-a-simple-code-but-i-dont-know-how-to-do-it/#findComment-208646 Share on other sites More sharing options...
amandas Posted March 16, 2007 Author Share Posted March 16, 2007 Thanks! I'll give it a try and let you know how it works. All of my clients have a folder on their account of the same name, but I want them to access it from my website since most of them forget all of the features they have. Amanda Link to comment https://forums.phpfreaks.com/topic/42950-please-helpneed-a-simple-code-but-i-dont-know-how-to-do-it/#findComment-208932 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.