----------------------------------- Amailer Wed Jul 16, 2003 5:55 am Basic php ----------------------------------- Starting off with the basic. How do you start a php code? What is the main thing? The means your ending the php script. How do you display something? like how do you display "Hello compsci"? The echo is used to display stuff on a web browser. It can also display HTML. Most people use echo to display their information. But you can also use: It does the same thing as ECHO. Now let make a small script with what we have learned. See? Simple, If you try this script and run it on your browser, you will see HELLO in BOLD. And on another line you will see, Welcome to compsci.ca world and on the next line. Have a great day. The and are HTML. How like some other languages, we have variables. For PHP the way you give a variable a vlue is like this When starting a variable you MUST put a $ before your variable name. The = tells php that the variable name you made, its value is what ever. Making it simpler...taking the sample code form above. the variable $variable, its value is HELLO. Now trying this out. Displayign the infromation the variable is very simple. You can do it by just using the echo or print we just learned. I.E: Now if you run this small script on your brower, you sould see Learned anything yet displayed there. Its displaying the value of the given variable..thats $variable :) Now rememebr...when you do ... echo $variable; ... you cannot add anything to that line...what i mean is this: ... echo $variable more words more words!; ... that will not work...so what you can do is 2 things. ... echo $variable . "more words more words"; //OR echo "$variable more words more words"; .... Both of the above work :) Now you cannot do this also. ... echo $variable1 $variable2; ... Nope that won't work...what you have to do is this. ... echo $variable1 . $variable2; ... that would work prefrectly :) (BTW, i forgot about this but the // means your commening something, you can also use # for commenting). Now to put what ever we learned to make a little script.