Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Autoredirect 2

Status
Not open for further replies.

bam720

Technical User
Joined
Sep 29, 2005
Messages
289
Location
US
I have a problem with a redirect.
Code:
$Refer[3] = "newequip.php?ClientName=$ClientNameF";
echo "<html><head><title>Add Equipment Results</title></head><body onload=setTimeout(\"location.href='\\".$Refer[3]."'\",2500)>";
I am using php to explode the referring URL and then putting that as the location. One page it comes from is already formatted with the Client Name in the URL. But the other page it comes from "newequip.php" needs to be sent back with the ClientName. I just have it formatted to removes sapces and put %20 in their place. When I load it from the page already formatted with the client name it redirect perfectly. However, when I try and do it from newequip.php its not working. The code above is the server side code. Here is the client side code it produces when coming from the newequip.php page.
Code:
<body onload=setTimeout("location.href='\newequip.php?ClientName=Fox%20Theatre%20Hill'",2500)>
does anyone have any ideas why it work for one but not the other? Here is the server dide code from the working page.
Code:
<body onload=setTimeout("location.href='\equipinfo.php?ClientName=Fox%20Theatre%20Hill&EquipName=T2'",2500)>

thanks
 
Did you copy and paste your code in here, or type it in? I don't see anything that would create the different actions in what you provided. If it's not copied and pasted, though, it's possible that the code you have isn't 100% accurate.

It appears that your script is redirecting to a file in the root directory of the drive, not the root of a web server or domain. Is this what you intend it to do?

Lee
 
I copied and pasted my source code, and then i copied and pasted the "view source" code for the client side code. As far as redirecting its going to the root of the server as it should be.
 
I just noticed this:

Code:
location.href='[b][red]\n[/red][/b]ewequip.php?ClientName=Fox%20Theatre%20Hill'

The backslash n (\n) means make a new line in Javascript. If you're using this on a webserver, use a forward slash instead.

Lee
 
Thanks you very much for the help. Worked great :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top