Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
added 47 characters in body
Source Link
Your Common Sense
  • 158.2k
  • 42
  • 226
  • 374

You're putting too much meaning in the php code blocks.
It's not something that global.
These blocks belong to the same PHP script. It's just a neat way to output HTML, nothing more. You can substitute it with echoing the HTML and there will not be the slightest difference.

The whole PHP script is being executed at once, not in iterations, as you probably picture this, thinking that PHP blocks are being executed server-side, then HTML blocks client-side, and then back to PHP blocks on the server side and so on. That's wrong.
The whole PHP script is being executed on the server side, resulting with pure HTML in the browser., and then dies.

That's why you can't program both an HTML form and its handler in the same PHP script by just placing the latter one right after first onethe former. You will have to make another call to the serverhave to make another call to the server to make the handler work. It will be another call completely, another instance of the same script, while the previous one has beenknowing nothing of the previous call which is long dead -already. And that's another thing you have to know about PHP:

PHP script execution is atomic. It's not like a desktop application constantly running in your browser, or even a daemon with persistent connection to your desktop application. It's more like a command-line utility - doing its job and exits. It runs discretely:

  1. a browser makes a call
  2. PHP wakes up, creates an HTML page, sends it to the browser and dies
  3. Browser renders that HTML and shows it to the user.
  4. User clicks a link
  5. a browser makes a call
  6. another PHP instance, knowing nothing of the previous call, wakes up and so on

You're putting too much meaning in the php code blocks.
It's not something that global.
These blocks belong to the same PHP script. It's just a neat way to output HTML, nothing more. You can substitute it with echoing the HTML and there will not be the slightest difference.

The whole PHP script is being executed at once, not in iterations, as you probably picture this, thinking that PHP blocks are being executed server-side, then HTML blocks client-side, and then back to PHP blocks on the server side and so on. That's wrong.
The whole PHP script is being executed on the server side, resulting with pure HTML in the browser.

That's why you can't program both an HTML form and its handler in the same PHP script by just placing the latter one right after first one. You will have to make another call to the server to make the handler work. It will be another call completely, another instance of the same script, while the previous one has been long dead - that's another thing you have to know about PHP:

PHP script execution is atomic. It's not like a desktop application constantly running in your browser, or even a daemon with persistent connection to your desktop application. It's more like a command-line utility - doing its job and exits. It runs discretely:

  1. a browser makes a call
  2. PHP wakes up, creates an HTML page, sends it to the browser and dies
  3. Browser renders that HTML and shows it to the user.
  4. User clicks a link
  5. a browser makes a call
  6. another PHP instance, knowing nothing of the previous call, wakes up and so on

You're putting too much meaning in the php code blocks.
It's not something that global.
These blocks belong to the same PHP script. It's just a neat way to output HTML, nothing more. You can substitute it with echoing the HTML and there will not be the slightest difference.

The whole PHP script is being executed at once, not in iterations, as you probably picture this, thinking that PHP blocks are being executed server-side, then HTML blocks client-side, and then back to PHP blocks on the server side and so on. That's wrong.
The whole PHP script is being executed on the server side, resulting with pure HTML in the browser, and then dies.

That's why you can't program both an HTML form and its handler in the same PHP script by just placing the latter one right after the former. You have to make another call to the server to make the handler work. It will be another call completely, another instance of the same script, knowing nothing of the previous call which is long dead already. And that's another thing you have to know about PHP:

PHP script execution is atomic. It's not like a desktop application constantly running in your browser, or even a daemon with persistent connection to your desktop application. It's more like a command-line utility - doing its job and exits. It runs discretely:

  1. a browser makes a call
  2. PHP wakes up, creates an HTML page, sends it to the browser and dies
  3. Browser renders that HTML and shows it to the user.
  4. User clicks a link
  5. a browser makes a call
  6. another PHP instance, knowing nothing of the previous call, wakes up and so on
deleted 139 characters in body
Source Link
Your Common Sense
  • 158.2k
  • 42
  • 226
  • 374

Well, after removing the misleading word, "function," from the question title, that deceived many people. It's now possible to answer.

You're putting too much meaning in the php code blocks.
It's not something that global.
These blocks belong to the same PHP script. It's just a neat way to output HTML, nothing more. You can substitute it with echoing the HTML and there will not be the slightest difference.

The whole PHP script is being executed at once, not in iterations, as you probably picture this, thinking that PHP blocks are being executed server-side, then HTML blocks client-side, and then back to PHP blocks on the server side and so on. That's wrong.
The whole PHP script is being executed on the server side, resulting with pure HTML in the browser.

That's why you can't program both an HTML form and its handler in the same PHP script by just placing the latter one right after first one. You will have to make another call to the server to make the handler work. It will be another call completely, another instance of the same script, while the previous one has been long dead - that's another thing you have to know about PHP:

PHP script execution is atomic. It's not like a desktop application constantly running in your browser, or even a daemon with persistent connection to your desktop application. It's more like a command-line utility - doing its job and exits. It runs discretely:

  1. a browser makes a call
  2. PHP wakes up, creates an HTML page, sends it to the browser and dies
  3. Browser renders that HTML and shows it to the user.
  4. User clicks a link
  5. a browser makes a call
  6. another PHP instance, knowing nothing of the previous call, wakes up and so on

Well, after removing the misleading word, "function," from the question title, that deceived many people. It's now possible to answer.

You're putting too much meaning in the php code blocks.
It's not something that global.
These blocks belong to the same PHP script. It's just a neat way to output HTML, nothing more. You can substitute it with echoing the HTML and there will not be the slightest difference.

The whole PHP script is being executed at once, not in iterations, as you probably picture this, thinking that PHP blocks are being executed server-side, then HTML blocks client-side, and then back to PHP blocks on the server side and so on. That's wrong.
The whole PHP script is being executed on the server side, resulting with pure HTML in the browser.

That's why you can't program both an HTML form and its handler in the same PHP script by just placing the latter one right after first one. You will have to make another call to the server to make the handler work. It will be another call completely, another instance of the same script, while the previous one has been long dead - that's another thing you have to know about PHP:

PHP script execution is atomic. It's not like a desktop application constantly running in your browser, or even a daemon with persistent connection to your desktop application. It's more like a command-line utility - doing its job and exits. It runs discretely:

  1. a browser makes a call
  2. PHP wakes up, creates an HTML page, sends it to the browser and dies
  3. Browser renders that HTML and shows it to the user.
  4. User clicks a link
  5. a browser makes a call
  6. another PHP instance, knowing nothing of the previous call, wakes up and so on

You're putting too much meaning in the php code blocks.
It's not something that global.
These blocks belong to the same PHP script. It's just a neat way to output HTML, nothing more. You can substitute it with echoing the HTML and there will not be the slightest difference.

The whole PHP script is being executed at once, not in iterations, as you probably picture this, thinking that PHP blocks are being executed server-side, then HTML blocks client-side, and then back to PHP blocks on the server side and so on. That's wrong.
The whole PHP script is being executed on the server side, resulting with pure HTML in the browser.

That's why you can't program both an HTML form and its handler in the same PHP script by just placing the latter one right after first one. You will have to make another call to the server to make the handler work. It will be another call completely, another instance of the same script, while the previous one has been long dead - that's another thing you have to know about PHP:

PHP script execution is atomic. It's not like a desktop application constantly running in your browser, or even a daemon with persistent connection to your desktop application. It's more like a command-line utility - doing its job and exits. It runs discretely:

  1. a browser makes a call
  2. PHP wakes up, creates an HTML page, sends it to the browser and dies
  3. Browser renders that HTML and shows it to the user.
  4. User clicks a link
  5. a browser makes a call
  6. another PHP instance, knowing nothing of the previous call, wakes up and so on
Made a substantial amount of grammatical fixes while preserving original voice
Source Link

Well, after removing the misleading word "function", "function," from the question title, that deceived many people, it's. It's now possible to answer.

You're putting too much meaning in the php code blocks.
It's not something that global.
These blocks belongsbelong to the same PHP script. It's just a neat way to output HTML, nothing more. youYou can substitute it with echoing those HTMLsthe HTML and there will be not abe the slightest difference.

WholeThe whole PHP script is being executed at once, not in iterations, as you probably picture this, thinking that PHP blocks are being executed server-side, then HTML blocks client-side, and thanthen back to PHP blockblocks on the server side and so on. That's wrong.
WholeThe whole PHP script is being executed on the server side, resulting with pure HTML in the browser.

that'sThat's why you can't program both an HTML form and it'sits handler in the same PHP script by just placing the latter one right after first one. You will have to make another call to the server to make the handler work. itIt will be completely another call completely, another instance of the same script, while the previous one is dead alreadyhas been long time agodead - that's another thing you have to know about PHP:

PHP scriptsscript execution is atomic. It's not like a desktop application constantly running in your browser, and notor even a demondaemon with persistent connection to your desktop application. It's more like a command line-line utility - doing it'sits job and exits. It runs discretediscretely:

  1. a browser makes a call
  2. PHP wakes up, creates an HTML page, sends it to the browser and dies
  3. Browser renders that HTML and shows it to the user.
  4. User clicks a link
  5. a browser makes a call
  6. another PHP instance, knowing nothing of the previous call, wakes up and so on

Well, after removing misleading word "function" from the question title, that deceived many people, it's now possible to answer.

You're putting too much meaning in the php code blocks.
It's not something that global.
These blocks belongs to the same PHP script. It's just a neat way to output HTML, nothing more. you can substitute it with echoing those HTMLs and there will be not a slightest difference.

Whole PHP script being executed at once, not in iterations, as you probably picture this, thinking that PHP blocks being executed server-side, then HTML blocks client-side and than back to PHP block on the server side and so on. That's wrong.
Whole PHP script being executed on the server side, resulting with pure HTML in the browser.

that's why you can't program both HTML form and it's handler in the same PHP script by just placing latter one right after first one. You will have to make another call to the server to make handler work. it will be completely another call, another instance of the same script, while previous one is dead already long time ago - that's another thing you have to know about PHP:

PHP scripts execution is atomic. It's not like a desktop application constantly running in your browser, and not even a demon with persistent connection to your desktop application. It's more like a command line utility - doing it's job and exits. It runs discrete:

  1. a browser makes a call
  2. PHP wakes up, creates an HTML page, sends it to the browser and dies
  3. Browser renders that HTML and shows it to the user.
  4. User clicks a link
  5. a browser makes a call
  6. another PHP instance, knowing nothing of the previous call, wakes up and so on

Well, after removing the misleading word, "function," from the question title, that deceived many people. It's now possible to answer.

You're putting too much meaning in the php code blocks.
It's not something that global.
These blocks belong to the same PHP script. It's just a neat way to output HTML, nothing more. You can substitute it with echoing the HTML and there will not be the slightest difference.

The whole PHP script is being executed at once, not in iterations, as you probably picture this, thinking that PHP blocks are being executed server-side, then HTML blocks client-side, and then back to PHP blocks on the server side and so on. That's wrong.
The whole PHP script is being executed on the server side, resulting with pure HTML in the browser.

That's why you can't program both an HTML form and its handler in the same PHP script by just placing the latter one right after first one. You will have to make another call to the server to make the handler work. It will be another call completely, another instance of the same script, while the previous one has been long dead - that's another thing you have to know about PHP:

PHP script execution is atomic. It's not like a desktop application constantly running in your browser, or even a daemon with persistent connection to your desktop application. It's more like a command-line utility - doing its job and exits. It runs discretely:

  1. a browser makes a call
  2. PHP wakes up, creates an HTML page, sends it to the browser and dies
  3. Browser renders that HTML and shows it to the user.
  4. User clicks a link
  5. a browser makes a call
  6. another PHP instance, knowing nothing of the previous call, wakes up and so on
added 816 characters in body
Source Link
Your Common Sense
  • 158.2k
  • 42
  • 226
  • 374
Loading
Source Link
Your Common Sense
  • 158.2k
  • 42
  • 226
  • 374
Loading