rubywolff Posted December 20, 2007 Share Posted December 20, 2007 Hi, I am trying to redirect a submit form to a new URL. The problem i cannot get around is that the files i am trying to redirect to end in .htm, i put in the file name click submit but it cannot fidn the page. if i put in filename.htm it redirects me to the page. Could any1 please help me to figure out how to amend this so that you put in the name of the file but it ends the url with .htm for me. the best i can do is get it ending in VAL01htm but not VAL01.htm. ??? <?php if(isset($_POST['Submit'])){ $base = "http://localhost/AirBIZ%20Site/Data/"; $url = $base . $_POST['url']; $file = @fopen($url,"r"); if($file){ header("Location: $url"); } else{ $err = "$url URL does not exist"; } } ?> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Track and Trace</title> </head> <body> <?php if(isset($err)){ echo $err; } ?> <form id="form1" name="form1" method="post" action=""> <label> <input type="text" name="url" /> </label> <label> <input type="submit" name="Submit" value="Submit" /> </label> </form> </body> </html> Thanks Ruby Quote Link to comment https://forums.phpfreaks.com/topic/82465-redirct-url-ending-htm/ Share on other sites More sharing options...
winmastergames Posted December 20, 2007 Share Posted December 20, 2007 Can you please wrap the Script with code tags thanks to make it easier to read Thanks Quote Link to comment https://forums.phpfreaks.com/topic/82465-redirct-url-ending-htm/#findComment-419242 Share on other sites More sharing options...
~n[EO]n~ Posted December 20, 2007 Share Posted December 20, 2007 don't understand what you are trying to do but changing this line might help $url = $base . $_POST['url']. ".htm"; Quote Link to comment https://forums.phpfreaks.com/topic/82465-redirct-url-ending-htm/#findComment-419247 Share on other sites More sharing options...
rubywolff Posted December 20, 2007 Author Share Posted December 20, 2007 Hi, I am a newie still...how would i do that? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/82465-redirct-url-ending-htm/#findComment-419248 Share on other sites More sharing options...
rubywolff Posted December 20, 2007 Author Share Posted December 20, 2007 @ ~n[EO]n~ dude, thank you so much. Works perfect. Have an awesome xmas. Quote Link to comment https://forums.phpfreaks.com/topic/82465-redirct-url-ending-htm/#findComment-419253 Share on other sites More sharing options...
~n[EO]n~ Posted December 20, 2007 Share Posted December 20, 2007 I am a newie still...how would i do that? Options and techniques available while posting a topic Have an awesome xmas. May the Love, Peace, and Joy of Christmas be yours always. And click Topic Solved when your problem is solved ..... Quote Link to comment https://forums.phpfreaks.com/topic/82465-redirct-url-ending-htm/#findComment-419254 Share on other sites More sharing options...
VirusDoctor Posted December 20, 2007 Share Posted December 20, 2007 Another (longer) way would be this: <?php if (isset($_POST['Submit'])) { $url = ($_POST['url']); $add = ('.htm'); $result = ($url.$add); echo $result; } ?> just take away the echo when using it, its just there to test the result. Quote Link to comment https://forums.phpfreaks.com/topic/82465-redirct-url-ending-htm/#findComment-419255 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.