Advanced Search

Results 1 to 9 of 9

Thread: Controlling the filename display in the address window

  1. #1
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    602
    Thanks
    266
    Thanked 13 Times in 13 Posts

    Default Controlling the filename display in the address window

    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:

    Code:
    <!--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!

  2. #2
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    You mean hide the filename? Like http://www.sitename.com/thisismyfile...eitshidden.wow But only show http://www.sitename.com/ when the page loads.

  3. #3
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    602
    Thanks
    266
    Thanked 13 Times in 13 Posts

    Default

    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.
    Last edited by kuau; 03-24-2009 at 02:40 AM. Reason: added more

  4. #4
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    This might help then http://www.dynamicdrive.com/forums/s...ad.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

  5. #5
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    602
    Thanks
    266
    Thanked 13 Times in 13 Posts

    Default

    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.

  6. #6
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    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?

  7. #7
    Join Date
    Sep 2007
    Location
    Maui
    Posts
    602
    Thanks
    266
    Thanked 13 Times in 13 Posts

    Default

    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.

  8. #8
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    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

  9. #9
    Join Date
    Mar 2009
    Posts
    65
    Thanks
    13
    Thanked 4 Times in 4 Posts

    Default

    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.

    PHP Code:

    $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

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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •