Reply to Re: Refresh Problems

Your name:

Reply:


Posted by J.O. Aho on 11/14/05 11:26

John wrote:
> I have a page that requests an index number from the user using a
> form. The submit then calls itself and a php lookup table determines
> the web page required and then does a jump.
>
> echo "<script>window.location.href='$a'</script>";

why not use an include_once() instead of the redirection, which really had
been more proper if you had used header() instead of the javascript which
requires that the client has javascript enabled which some don't due security
problems and such.

http://www.php.net/manual/en/function.include-once.php
http://www.php.net/manual/en/function.header.php


> However if the user hits the back button the jump is made again and
> the page they are on simply reloads, as you would expect.

That is according to the rules

form_page -> redirect_page -> displayed_page

When making a back, you get back to the redirect_page and it will then
automatically redirect the user back to the displayed_page, so you need to get
rid off the redirect_page and then the include_once() will work a lot better

form_page -> displayed_page

You do things quite the same way as you did before with the javascript thing,
but don't make any outputs in the page in the question, except if you want to
generate error messages.
Instead of populating the variable $a you include the html/php page directly

eg:

switch($page_chose_from_form) {
case 1:
$a="http://example.net/mydir/myfile1.html";
break;
case 2:
$a="http://example.net/mydir/myfile2.html";
break;
case 3:
$a="http://example.net/mydir/myfile3.html";
break;
}

would be

switch($page_chose_from_form) {
case 1:
include_once('myfile1.html');
break;
case 2:
include_once('myfile2.php');
break;
case 3:
include_once('myfile3.html');
break;
default:
echo "The page don't exist!!!!";
break;
}



//Aho

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация