iGuest 3 Report post Posted November 25, 2004 What is PHP? PHP is a server side scripting language that's used (mostly) within HTML, being a server side language it means the code is processed or "parsed" and sent to the browser as simple HTML, so people don't need any sort of addons to read the pages, like flash plugins etc. If you don't have a reasonable understanding of the basics of HTML then really you're starting in the wrong place, but if you do, then the basics of PHP at least are not difficult to learn, you'll also find that experience of any other kind of scripting language is a benefit, if you use mIRC you'll even see similarities with if and else statements and other syntax. Share this post Link to post Share on other sites
iGuest 3 Report post Posted November 25, 2004 What can i do with it? The first time i looked at a PHP tutorial (which wasn't very long ago) i first thought why the heck do i want to mess around with all this echo and print stuff when i can just type what i want on a blank page and it'll appear? well i soon changed my mind, PHP gives you so many more choices and options than basic Javascript, you'll soon be adding things to your pages that you probally never thought possibile, or at least didn't expect them to be so simple. Basically PHP makes it very simple to Collect, process and store data Create dynamic page content Create a more "interactive" website And much more ... Using PHP with one of the many databases that it supports (mysql, dbase, oracle etc) is when it really starts to get fun Share this post Link to post Share on other sites
iGuest 3 Report post Posted November 25, 2004 How do i use it? Well obviously first of all you'll need a host that supports PHP, any paid hosting package should give you PHP support these days and there's alot of free hosts that offer PHP now also, and any pages that include PHP scripting need to be given a .php extension, instead of .htm or .html First of all, just quickly a little PHP syntax. 1. Tabs, spaces and returns don't really matter for example <?php echo (" blah "); ?> would be the same as <?php echo("blah"); ?> 2. Each PHP statement must end with a semicolon ; 3. You can make comments inside your PHP tags in three ways <?php /* comments here */ //comments here #comments here ?> With the last two, the comments would extend to the end of the line. Share this post Link to post Share on other sites
iGuest 3 Report post Posted November 25, 2004 Using PHP on your pages Any PHP that you want to include in your HTML pages is contained within it's own tags, which are: <?php code goes here; ?> You may see some people (including myself) using just this: <? code goes here; ?>But although you'll probally never come across the problem, the shorter form tags are not supported on all servers so it's probally better to get in the habbit of using the first. Now you can add your PHP code at whatever points you like within your normal pages, the first example here being how to output text. "print" and "echo" are what we use to display text on the page when we're using PHP, for example: <?php echo("i like bananas"); ?>Would display the text "I like bananas" (without the quotes) on your page.But you can also use "print" to give the same output eg: <?php print("i like bananas"); ?>Would display the same thing. So what's the difference? well so far the only difference i know of between using print and echo is that echo gives you the option to output multiple lines, like echo ("do one thing", "do another thing"); print doesn't support using a comma to seperate lines like that, as far as i know there's no other difference, most examples and tutorials i've seen tend to use echo 90% of the time. One other basic example i'll give is setting a variable with php, because it's something that eventually you'll use quite often. Share this post Link to post Share on other sites
iGuest 3 Report post Posted November 25, 2004 Variables We use variables for values that are likley to change, so we always have something familiar to relate to when we want to display or use that value. Here's a basic example, it's probally not something you'd use but it just gives the general idea how variables work in PHP. <?php $title = "Welcome to my webpage"; ?> <html> <head> <title><?php echo("$title"); ?></title> </head>That would set your page title to "Welcome to my webpage" , so basically we set the variable with $variable="value"; then we can just echo or print it to our page wherever we like. Some other basic points about variables in PHP. They can be any size, e.g everything on this page could be set as one variable called $tutorial or whatever. All PHP variables are defined by the dollar sign $ They must always begin with an aplhabetic character a-z or an underscore _ NOT with a number. They are CASE SENSITVIVE so setting a variable named $blah would not be the same as a variable named $BLAH -------------------------------------------------------------------------------- I hope this helped a little bit Share this post Link to post Share on other sites
iGuest 3 Report post Posted November 25, 2004 sure :)just don't post as much bold Share this post Link to post Share on other sites
iGuest 3 Report post Posted December 19, 2004 I agree; it has helped. But when writing something like this, you should only use the bold font to emphasise certain parts. Share this post Link to post Share on other sites
iGuest 3 Report post Posted December 20, 2004 Could you please provide me with a reference more detailed about the uses of PHP? I am looking into learning php, but I want to stick with my combination of css, html, and the php include function for my website. The only content on my website is like text and pictures and files, there is no forum or anything, however I might put up an image gallery for other people to upload their pictures (not likely though) so I don't seen much need of PHP. My website is very easy to handle becuase of the single include function, and your tutorial says content management which might come in handy, although I need more detail. Also wondering what mysql can have to do with my website.Nice tutorial though ^^skyglow1 Share this post Link to post Share on other sites
iGuest 3 Report post Posted December 20, 2004 nice a little bacit but nice what i did to learn was jut to download scripts from hot scripts or somewere and just figure out how they work and some helpfull infor for when you stuck and you want to display some color coded code instead of saving a file with the extention on php use phps witch results as this for example http://forums.xisto.com/no_longer_exists/outputhttp://forums.xisto.com/no_longer_exists/ Share this post Link to post Share on other sites