Yes I Do Hav Another On Enjoy Josh`
Posted: Thu Mar 04, 2004 6:37 am
[color=\"red\"]Getting Started [/color]
Create a file named [color=\"blue\"]hello.php[/color] and put it in your web server's root directory (DOCUMENT_ROOT) with the following content:
<html>
<head>
<title>[color=\"green\"]PAGE TITLE[/color] </title>
</head>
<body>
<?php echo '<p>Hello World</p>'; ?>
</body>
</html>
Use your browser to access the file with your web server's URL, ending with the "/hello.php" file reference. When developing locally this URL will be something like http://localhost/hello.php or http://127.0.0.1/hello.php but this depends on the web server's configuration. Although this is outside the scope of this tutorial, see also the DocumentRoot and ServerName directives in your web server's configuration file (for Apache, this is httpd.conf). If everything is configured correctly, this file will be parsed by PHP and the following output will be sent to your browser:
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<p>Hello World</p>
</body>
</html>
[color=\"red\"]Forms[/color]
<form action="action.php" method="post">
Your name: <input type="text" name="name" />
Your age: <input type="text" name="age" />
<input type="submit" />
</form>
There is nothing special about this form. It is a straight HTML form with no special tags of any kind. When the user fills in this form and hits the submit button, the action.php page is called. In this file you would write something like this:
Hi <?php echo $_POST['name']; ?>.
You are <?php echo $_POST['age']; ?> years old.
Then the script should show:
Hi Danny. You are 14 years old.
It should be obvious what this does. There is nothing more to it. The $_POST['name'] and $_POST['age'] variables are automatically set for you by PHP. Earlier we used the $_SERVER autoglobal; above we just introduced the $_POST autoglobal which contains all POST data. Notice how the method of our form is POST. If we used the method GET then our form information would live in the $_GET autoglobal instead. You may also use the $_REQUEST autoglobal, if you do not care about the source of your request data. It contains the merged information of GET, POST and COOKIE data.
(More Will Be Added Later!)
Create a file named [color=\"blue\"]hello.php[/color] and put it in your web server's root directory (DOCUMENT_ROOT) with the following content:
<html>
<head>
<title>[color=\"green\"]PAGE TITLE[/color] </title>
</head>
<body>
<?php echo '<p>Hello World</p>'; ?>
</body>
</html>
Use your browser to access the file with your web server's URL, ending with the "/hello.php" file reference. When developing locally this URL will be something like http://localhost/hello.php or http://127.0.0.1/hello.php but this depends on the web server's configuration. Although this is outside the scope of this tutorial, see also the DocumentRoot and ServerName directives in your web server's configuration file (for Apache, this is httpd.conf). If everything is configured correctly, this file will be parsed by PHP and the following output will be sent to your browser:
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<p>Hello World</p>
</body>
</html>
[color=\"red\"]Forms[/color]
<form action="action.php" method="post">
Your name: <input type="text" name="name" />
Your age: <input type="text" name="age" />
<input type="submit" />
</form>
There is nothing special about this form. It is a straight HTML form with no special tags of any kind. When the user fills in this form and hits the submit button, the action.php page is called. In this file you would write something like this:
Hi <?php echo $_POST['name']; ?>.
You are <?php echo $_POST['age']; ?> years old.
Then the script should show:
Hi Danny. You are 14 years old.
It should be obvious what this does. There is nothing more to it. The $_POST['name'] and $_POST['age'] variables are automatically set for you by PHP. Earlier we used the $_SERVER autoglobal; above we just introduced the $_POST autoglobal which contains all POST data. Notice how the method of our form is POST. If we used the method GET then our form information would live in the $_GET autoglobal instead. You may also use the $_REQUEST autoglobal, if you do not care about the source of your request data. It contains the merged information of GET, POST and COOKIE data.
(More Will Be Added Later!)