Category: php
Explanation of PHP Basic Syntax --New to PHP
Php is a language that is very much like writing c. The best feature of PHP versus c is that it is designed primarily to be used on WebPages -- allowing the author to intermingle their php code and the HTML on the same page. Being able to mix these two languages together provides a very flexible environment that allows the author to code some very nice dynamic content. PHP is called a server side scripting language. Unlike a computer language such as C++, Visual Basic, Java and others, php does not require the programmer to have a traditional compiler. Instead PHP interprets the code and sends it back to the web server. This is sometimes referred to as JIT -- just in time compiling.
The Webserver in turn serves up a webpage that is formatted according to the instructions found in a php script and sends it to the client that requested it (usually a web browser running on a home pc or laptop). Using a language like php for web scripting makes it possible for a web designer to create a single page that can return completely different content every time a user leaves and then returns.
This is usually accomplished by embedding variables into hyperlinks or by using input text boxes. When the user clicks on the embedded links, the variables coded into those links is sent out to the webserver. You have probably noticed that when you click some links and look up in your web browser - there is this a long string of characters that looks something like this like this:
http://mrarrowhead.com/index.php?page=php_passing_variables.php
Notice the question mark right there after "index.php." the question mark tells the server to start looking for variables to parse (or interpret). Next, in the example link above, there is the "page" variable with an equals sign between it and "php_passing_variables." When this link is clicked the php script that the thenlinks points to loads into the user's web browser retrieving the "page" variable which is stored in a global variable array called $_GET.
The "page" variable looks like this $_GET['page']; to the programmer. This is called the GET method.
There are several other mtypes of varibles that you will become aquainted with as you learn php web programming.
Now, let’s go over some basic php syntax. The first thing to cover is how to jump into and out of php code from within your webpage’s HTML.
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>;
<title>Page Title Goes Here</title>
<body>
<?php
echo "You will see this when you run the script";
?>;
<h2>Then you can just add html where you want it</h2>
<?php
echo "now you can go back into php if you want to.";
?>
</body>
</html>
Notice from the example above that you must start all of your PHP code with
and it is ended with
?>
These two tags let the webserver running PHP know what parts of a web page are php code. Also notice that at the end of the echo statements, there is a semicolon. Semicolons in php tell the compiler when a line of code has been read and another line is about to start. Each simicolone signifies the end of a line of code.
The semicolon can be included on the same line but php will still treat it as the end of a line.
The next section will cover php code blocks and variable data types.
using php cookies variables
Using Cookie Variables in PHP
Setting cookies in php is pretty straight forward. There is a php function:
setcookie();
This function mu
Filezilla Filezilla Ftp Client, FTP SERVER vs Wsftp
By: D.Shaun Morgan
While I was writing this article, about halfway through, I realized that it would be unfair to tell my readers about
notepad plus Notepad++
Download Notepad Plus Plus
Notepad plus plus is an open source, free text editor. It is
retreive images mysql php php How to get images out of mysql database with php and use them on my webpages
Author: D.Shaun Morgan
PHP Version - PHP 5x
how to make money online php Making Money on the Internet
Sign up for this series of free money making articles
Name:
Leave a Comment
what-is-php
Re: Admin
Thank you!