KevinM1 Posted August 20, 2010 Share Posted August 20, 2010 So I don't need a "PHP Header" like you need to define an HTML block? And for my simple registration form, I guess most if not all of my file will be HTML? Is it a sin if you had 100% HTML in a file called MyFile.php? (I was just taught in the past to make all your files ".php" for consistency...) Nope, you don't need any kind of starting tag/header/preprocessor call/etc. at the beginning. There's a small caveat with HTTP header redirects, but you're not even close to needing to worry about that. For your form file, unless you're going to add PHP to it later, I'd just keep it as a straight HTML file. Why make the server do more work than it needs to do to render the page? I wouldn't be worried about file extension consistency. It's much better to be consistent with actual file names and your directory structure. Quote Link to comment Share on other sites More sharing options...
Psycho Posted August 20, 2010 Share Posted August 20, 2010 To add to Nightslyr's response, HTML tags are just that - HTML tage which tell the browser how to render the page. The browser has nothing to do with PHP code and doesn't know how to process it. The idea behind PH (and other server-side code) is that the server will process the server-side code and output a complete HTML page to send to the browser. Here is an example php page (date.php): <html> <body> The date today is <?php echo date('F d, Y'); ?> </body> </html> When a user requests the page date.php the page will first be processed by the server (html files normally go strait to the user). The PHP processor will look for any PHP codeblocks and process the code. In this instance, the processor will echo (i.e. print) the current date where indicated. The completed page (consisting of only HTML content) is then sent to the user. The final HTML code would look like this: <html> <body> The date today is August 20, 2010 </body> </html> The user who views the page would only see that content if they were to "view source" on the displayed page. Quote Link to comment Share on other sites More sharing options...
TomTees Posted August 20, 2010 Author Share Posted August 20, 2010 Thanks Nightslyr and mjdamato for your responses. I think I'm going to unfortunatelt go break down and re-buy the book I have on HTML and CSS in storage. (I'm a book guy and it looks like I need to sit down and re-read all of this stuff again to start sounding intelligent. UGH!) So maybe after I get these super basic questions down better, I can pick up with getting help on tying my web pages to back-end classes that do processing. To be continued... TomTees Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.