as I know (not sure), a php file is always re-executed from first line to last line after user presses a submit button - is this right?
for example, I add following code in a php file:
<?php
if(isset($_POST['form_Submit']))
{
//something
}
?>
//more html code here which includes a form with submit button.
if user presses submit button, the file will be re-executed from first line to last line, right?
If right, it causes a big visual problem: the file will be re-loaded again and whole page twinkles - bad visual performace.
how to avoid the problem?
thanks
executing process of php file
Moderator: General Moderators
-
php12342005
- Forum Commoner
- Posts: 79
- Joined: Mon Mar 21, 2005 3:35 am
When submitting a form, you are POSTing the data to another page. So, you are moving from the current page to that new page (which, could actually be the curent page - confused?). The "twinkle" you see is the page loading again.
While it would be bad performance for an executable program - PHP build web applications, so going from one page to another is to be expected.
An alternative might be XMLhttp - lets you send and receive data without reloading a page. ~Burrito knows quite a bit.
While it would be bad performance for an executable program - PHP build web applications, so going from one page to another is to be expected.
An alternative might be XMLhttp - lets you send and receive data without reloading a page. ~Burrito knows quite a bit.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
-
php12342005
- Forum Commoner
- Posts: 79
- Joined: Mon Mar 21, 2005 3:35 am
That's often done - submiting a form to the current page. However, that won't remove the flicker you see.
The way PHP, webservers and the Internet work is through stateless connections. When you submit your form to the current document, you're actually asking the webserver to send you another copy of the document. So, there will be a flicker (or possible a longer wait) regardless of the page you submit your form data to.
The way PHP, webservers and the Internet work is through stateless connections. When you submit your form to the current document, you're actually asking the webserver to send you another copy of the document. So, there will be a flicker (or possible a longer wait) regardless of the page you submit your form data to.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.