html / xhtml, css, php, mysql, javascript, asp, seo, web management, semantics, accessibility and more.
PHP : Beginners Guide PT.1 - All the details and information you need to get started with using PHP.
In category php.
Posted by Joseph Skidmore on 11.09.05.
Last edited on 11.09.05.
PHP stands for Hypertext Preprocessor and is used for background programming for web sites.
PHP can do many things, such as creating a hit counter, login script, guestbook ... really complex things ... even really easy things such as displaying the time on your page or forwarding a user to a new page (re-direct). The possibilities really are endless.
As a beginner to PHP you may have searched the web and found the ultimate tutorial on how to start learning PHP;
<?php
echo 'Hello World!';
?>
This script will echo (or print) Hello World! on your page. WOW! We really are going places now ... I think not, this is pretty much useless and tells us nothing. PHP can even colour my code as above ;) As shown in my highlight_string(); tutorial.
I think the best way to start learning PHP is by explaining exactly what it is used for and go through some key points.
No, CSS styles your page, PHP programs it ... think of all these web design languages like a car, PHP would be the engine running the car while CSS would be the bodywork of the car. You see the difference? One language runs it while the other makes it look good.
Good question, if a page has a PHP extension that means it could be anything from having a simple small PHP code inside to being entirely written using PHP ... to include any size PHP scipt on a page, for it to work it must have a .php extension. You can name pages with a .php extension even if they contain no PHP code within, the page does not display any differently.
It depends on how good your memory is really, in my case (very bad) I like to write all the X/HTML first to get the design/layout of the page as I like it and then add the PHP code afterwards. You can write them both together if you like but it all depends on your own personal preferences.
I have heard many people ask this question, you would be right for thinking, new language, new doctype ... but no, PHP needs no doctype as it purely depends on what X/HTML you are using the same as if you wasn't using any PHP at all.
No, if your script doesn't work, one way or another you will know about it. Either with an error appearing on screen or your code won't perform the function you want it to. If it works then you know it is valid.
Notice: Undefined index: name in c:locationtoindex.php on line 70 Notice: Undefined index: emailurl in c:locationtoindex.php on line 72 Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in c:locationtoindex.php on line 87 Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in c:locationtoindex.php on line 89
As you can see, instead of my script performing whatever function it has these are displayed on screen instead, showing you that your code does not work.
Anyway you want, as I mentioned already I like to get the HTML drawn up first and then add the PHP afterwards (easier in my opinion) but again, it depends entirely on your own personal preference.
Page generated in 0.0013 seconds.