MDanz Posted October 14, 2009 Share Posted October 14, 2009 i have an input text field and submit button. how do i make the url entered into the textfield go to that webpage? Link to comment https://forums.phpfreaks.com/topic/177721-solved-url-go-to-webpage/ Share on other sites More sharing options...
trq Posted October 14, 2009 Share Posted October 14, 2009 header("Location: " . $_POST['url']); Link to comment https://forums.phpfreaks.com/topic/177721-solved-url-go-to-webpage/#findComment-937082 Share on other sites More sharing options...
MDanz Posted October 14, 2009 Author Share Posted October 14, 2009 i know i did this wrong... it says header already sent.. <body><form enctype='multipart/form-data' action='link.php' method='post' name='changer'> <label>URL <input type="text" name="url" /> </label> <label> <input type="submit" name="Submit" value="Submit" /> </label> </form> <?php header("Location: " . $_POST['url']);?> </body> Link to comment https://forums.phpfreaks.com/topic/177721-solved-url-go-to-webpage/#findComment-937089 Share on other sites More sharing options...
trq Posted October 14, 2009 Share Posted October 14, 2009 You can't output any html before calling header. <?php if (isset($_POST['url'])) { header("Location: " . $_POST['url']); } ?> <body><form action='' method='post' name='changer'> <label>URL <input type="text" name="url" /> </label> <label> <input type="submit" name="Submit" value="Submit" /> </label> </form> </body> Link to comment https://forums.phpfreaks.com/topic/177721-solved-url-go-to-webpage/#findComment-937092 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.