Log in

View Full Version : Controlling the filename display in the address window



kuau
03-23-2009, 10:40 PM
I know there is a way to display a specific filename in the address window but can't figure it out and am not sure what it is called to do a search (sorry).

I tried putting this in the php file:


<!--script>
if (window.self == window.top){ window.top.location = "http://www.homepage.com/"; }
</script-->

but it gives an error message "Unexpected '<' found". It also failed when I took the '!-- --' out.

Currently it displays the php calculation filename which is not very pretty. I'd rather do it with php than javascript as I am braindead when it comes to javascript. Would appreciate some advice. Thanks!

bluewalrus
03-24-2009, 01:59 AM
You mean hide the filename? Like http://www.sitename.com/thisismyfilenameandnoonewillknownowcauseitshidden.wow But only show http://www.sitename.com/ when the page loads.

kuau
03-24-2009, 02:37 AM
Basically, yes. But I'm not trying to hide anything. The filename is check.php. The problem is that it performs calculations and, depending on the input, takes the viewer to one of several different pages with the results of the calculations. Each of these pages shows http://www.domain.com/php/check.php in the address bar. For some reason it does not show the URL of the result pages (?). That I wouldn't mind, although the same thing may happen.

If you bookmark the result page it actually bookmarks /check.php so when you try to come back to it, you get a SQL error message because the variables are not filled in. So I want it to bookmark the home page instead to avoid errors. Nothing underhanded.

bluewalrus
03-24-2009, 03:24 AM
This might help then http://www.dynamicdrive.com/forums/showthread.php?t=41941

Also using "get" may help with being able to bookmark results but is limited to 50 characters (pretty sure) and shouldn't be used if passwords or things like that will be being passed as it will display the info in the address bar

kuau
03-24-2009, 03:44 AM
Thanks for all the info. I did read it all that but I suspect it is overkill and I'm not sure it is what I am after anyway. Perhaps my question should have been:

Is there a way to tell the browser what to add as a bookmark for a particular page?

Thanks. :)

bluewalrus
03-24-2009, 04:11 AM
What is being altered from page to page is it a search bar or something with multiple values?

Do you have a link that the form is on?

kuau
03-24-2009, 04:24 AM
Here is the website: www.carrentalhawaii.com

Just click on the "Free Price Check" button and you'll see what I mean. If you select a different country, different car class, different dates, etc, it totally changes the results.

It is the result page I want to bookmark as the home page so they have to enter the variables again.

bluewalrus
03-24-2009, 05:00 AM
Try changing <form class="rentalform" name="rental" method="POST" action="/php/check.php" onSubmit="return validate()" >
to
<form class="rentalform" name="rental" method="GET" action="/php/check.php" onSubmit="return validate()" >

and in PHP change all $_POST to $_GET

...maybe that should put the values in the address

CrazyChop
03-28-2009, 07:16 AM
There are two ways to do this.

One way is to have a index.php which detects which page to load based on the $_GET querystring.




$page = $_GET['p'];

switch $page
{
case "index":
include_once("index.php");

case "check":
include_once("check.php");

default:
include_once("index.php");
}


The second way is to use a template engine. Smarty is one but it is needlessly complex for simple projects. Right now I am use EasyTemplate (http://domebo.net/forum/index.php?sid=08aa2d96890d91fdb429681ad656e673)

Do check it out. It's harder to learn but it would be more beneficial in the long run