Jump to content
Larry Ullman's Book Forums

Question about how php file is executed

Recommended Posts

First, thanks to the author for the great book. I have some limited coding experience (FORTRAN) and would like to learn PHP. Could someone point me to the right direction to understand how php file is executed? Example: Script 13.5 (Logging In). How is possible to check for the email and password (code lines 12-14) when the form to enter that information is defined after it (lines 53-56)? I expected it to be opposite. First to create form (user can enter username/pass) and after that to check if it matches the admin info. I struggle to understand "check if the form has been submitted" meaning. If it was not submitted, how is possible to check it again after user enters username/pass (lines 53-56). Appreciate any help!

Edited by nobra
Link to comment
Share on other sites

Thanks for the nice words! It sounds like maybe you jumped to a later chapter. One of the earlier chapters (8, maybe?) talks about having a PHP script both display and handle a form. It explains what's going on here in more detail. The short answer is the same PHP script is being accessed in two different ways (i.e., via GET to display the form and via POST to handle the form's submission). 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...