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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Document.write function

Status
Not open for further replies.

leegodden

IS-IT--Management
Apr 6, 2007
3
GB
Hi This is probably an easy one

I have a php search page which looks up an mysql database, and if there are no results to show from user entry then i use the document.write fuction as seen below to send the user to a html page
else print "<script>document.location.href='no_results.htm'</script>";
The no_results page loads fine but the back button on the browser is then disabled, and I am stuck on the page. I could build a button that uses the History.go() function but I still would like the user to use the browsers back button if they wanted to. Is there a fix or workaround for this please
Any help would be much appreciated

Regards
Lee
 
Why not skip javascript entirely and use PHP to redirect the user?...Just a thought (in case the user has JS turned off)
 
Would like to but have had so much trouble with the headers error in PHP, and not sure how to overcome this. I understand the principal behind the error ie( header calls must be before any other output, and the whitespace between th <? ?> tags issue, but cannot get it to work

Thanks

Lee
 
Pass the URL of the page that the browser was on right before they got redirected to the no_results.htm page in a form. Pull that value on the no_results.htm page and make a button that onclick will redirect to that URL.

That should work, however I do think jammer1221's idea is better.

[monkey][snake] <.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top