You are invited to Log in or Register a free Frihost Account!

is there any way to trigger a .php file without refreshing?

I couldn't find a proper thread for my question
if you happen toknow, just direct me to the post.

The problem i'm seeing is this.
Whenever i submit a form using post method, the current page is replaced by .php page and never returns to the original page.
I know i can put some kind of header() function to return to the original page but i don't like my page to be reloaded and flashed.

Is it possible to call a .php file and run it like a background process so that i won't be bothered by flashing page?

have you tried to put header(firstsite.php) in the bottom of the .php site you don't want?
Is it possible to call a .php file and run it like a background process so that i won't be bothered by flashing page?

That's the exact point of the various "Ajax" approaches. You use Javascript, and one of a few methods (usually the XMLHttpRequest object or hidden IFRAMEs) to call the .php, getting back the page in a Javascript property, which you can then simply discard or use to update your page without reloading. The famous examples being GMail and Google Suggest. In simple terms, Javascript talks to the server without anything happening in the browser window.

It's relatively simple to implement if you know Javascript, although there are some pitfalls in terms of browser compatibility etc. It should also always be considered whether using such an approach enhances or degrades the user experience. And in most cases, it would be a good idea to still support the "old way" of doing it, for users who have an old browser, or have Javascript disabled.
Thanks for posting you guys. looks like i have to look at what 'Ajax' is. At first i just started to write a php code for fun. and now it pushes me to run too many things, sql, xml, now ajax. i don't know where to stop for this quest. I feel like i know too much for a web surfer Very Happy
If you understood you right, you want to run a page the whole time. For that, you can use a header to refresh the page.
For example, you can use this code:

After 60 seconds, the script would forward the browser to Don't set the refresh-time too low or it'll generate a lot of traffic.
I hope I could help.
you can always use JavaScript..
just do a timer
if you need any help tell me
looks like header function with refresh does not work well with IE. Instead i'll rather write a mimic php code

$s_url = '';
if (headers_sent()) exit("Headers already sent. Can not redirect to $url");
echo '<meta http-equiv="refresh" content="10; url='.$s_url.'">';

javascript is a clientside script and thus hard to use for modifying files in the server.

Stubru Freak
afracsass wrote:
if (headers_sent()) exit("Headers already sent. Can not redirect to $url");

Isn't needed using this method
Related topics
Cron jobs - running a php file
[PHP doubt]Knowing the directory location of PHP file
Uploading a .php file! NEED HELP thanks
what is dump?
400 Frih for Phpbb skin (formaly 800 Reddish Blue Website)
User Viewing A PHP File
send variable from php tp php file
Running PHP Script without PHP Server?
Limiting php file functions with .htaccess
Remote php file access and reading
PHP running PHP
including javascript in php file
Hide PHP file extension
[TuT]JOOMLA Installation Guide(Easiest Way)
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

© 2005-2011 Frihost, forums powered by phpBB.