HTML Tutorial


 Forum HomeForum Home   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
PHP Redirect to url ending .htm
Post new topic   Reply to topic    HTML Help Forum Index -> PHP
View previous topic :: View next topic  
Author Message
rubywolff



Joined: 19 Dec 2007
Posts: 1

PostPosted: Wed Dec 19, 2007 2:52 am     PHP Redirect to url ending .htm Reply with quote

Hi,
I have the below code 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

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 in .htm for you. the best i can do is get it ending in VAL01htm but not VAL01.htm.
Sad

<?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
ogsolution



Joined: 26 Dec 2007
Posts: 144

PostPosted: Fri Dec 28, 2007 1:11 am     Reply with quote

To me it sounds like all you need to do is concatenate .htm to the end of your url string.

$url = $base . $_POST['url'] . '.htm';

I don't know if that helps or not.
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum Index -> PHP All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
HTML Help topic RSS feed 

 
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   Link Directory   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial