Jump to content
xisto Community

XRated

Members
  • Content Count

    74
  • Joined

  • Last visited

Everything posted by XRated

  1. XRated

    Hello

    So this is where the introduction forum was hiding , so ive noticed Xisto "google" and so far not a bad looking service at all.. a couple post's and you got a nice package with no ads and all the support needed for an ok site . I do not have an account yet but with all the registerd user's and so much to reply to , it basically sell's it's self , anyhow hello
  2. Notice from BuffaloHELP: Merged two topics for two different tutorial approach. Please search the forum before making a new topic. Im not sure if this is supose to go in the programming forum or here , this said "Tutorials" so ive decided here , if im wrong you may move it or delete it --------------------------------------------------------------------------------------------------------------------------- I figured it's time to make a small tutorial , by reading this tutorial you should have the basic know how to execute small script's on your php enabled servers. Note that i will not be explaining how to set up a web server + php. What Does PHP Stand For? PHP- Hypertext Preprocessor Starting & Ending Tags We start off by learning the 2 main tag's that you must never forget , that is the starting and ending tag's. Starting <?php Ending ?> Baisc Syntax Now that you know about the starting & ending tag's , let's start with a basic script. <?phpecho "This is my first php script!";?>so you have noticed echo , echo is simple, it output's the text "This is my first php script!" , now you must end this with a semicolon , why? the semicolon is a seperator and is used to distinguish one set of instructions from another. Variables Now that you know some basic syntax let's start working on variables , variables are ton's of fun and one of the most important part's of PHP. <?php$myfirstscript = "This is my first php script!";echo $myfirstscript;?> So you have noticed $myfirstscript , i made the variable $myfirstscript that hold's the string "This is my first php script!" . Then ofcourse just echo'd the variable which would output "This is my first php script!". Comments Comments are also another important thing not only in php but all languages , there used to disable any type of information inside them from actually executing with your script which ofcourse would likely cause error's. //This is a comment/*This isacomment block*/ Condition Statements Now these are fun to play with , they are used to execute certain code on a condition. <?php$mybrowser = "Fire Fox";if ($mybrowser == Fire Fox) { echo " You are using firefox!"; }else { echo " You are not using firefox"; }?> So here i have set a variable equal to my browser then made a condition, if my browser is equal to firefox, output "You are using firefox" else (if your using something else) output "You are not using firefox" . Ofcourse this will not work untill i i add more to it but it give's you all a idea how condition statements work. Looping Looping is used for many many thing's , there are more then just one loop statement, ill explain how to do the "While Loop". <?php$z = 1;while ($z <= 5) {echo $z;$z++} Again i made a variable named z with the value of 1 , then stated while z is less or equal to 5 while ($z <= 5)output the value of z echo $z , increase z by 1$z++. Which would output 1-5 on your page. Simple isn't it? Forms Now im assuming you have some basic understanding of html, although i will give an example of the html form but i will not be explaining it. <form action="form.php" method="post">Name: <input type="text" name="name"><input type="submit" value="Submit"> That's the html form , very simple. Now to the fun part. <?php$name = $_POST["name"];echo "Hello ". $name;?> Now here you have noticed something new and that would be "$_POST["name"]", $_POST is a variable already set by php , it recieved the information givin in the html form , notice the name="name" in the html form and ["name"] in $_POST. Now this is the end of this small basic tutorial , you should now have the knowledge to execute simple script's on your server's If you wish to learn more about PHP you may visit some links to tutorial's i will provide you below. PHP.Net - Recommended W3Schools - Recommended
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.