Advertisement

Archive for April, 2008

Step 3: PHP Codes

Now that we have completed making the form page, we now need PHP coding to write the data to text file.

To do this, again open form.php On the top of everything, write this code:

PHP Code:
if (isset($_POST['submit'])) {
// Do something
}
?>

This means if $_POST['submit'] is set, where ’submit’ is the “name” of the submit button, then do something.
We used here $_POST[] because we used form method=”POST”, if we had used method=”GET “, then we would have used $_GET[] here.
Now we need it to do something if the submit button is set.
So, to do this, we will add some code on our current code.
We will add everything we need, after or by replacing “// Do something“.
Before we make the script write to file, we need to make sure of following things:
If on Linux, file must have writing permission , that is, CHMOD 777
Now start writing code !

Tutorials

Writing to file using PHP Form - Step 2: CSS Codes
Category: PHP Mysql Tutorials
Author: Bilal Ghouri Date: Apr 21 2008 | Views: 530
Writing to file using PHP Form - Step 1: HTML Codes
Category: PHP Mysql Tutorials
Author: Bilal Ghouri Date: Apr 21 2008 | Views: 1237
Redirecting users according to their country TLD
Category: PHP Mysql Tutorials
Author: Bilal Ghouri Date: Apr 18 2008 | Views: 287
Macromedia and Adobe Flash Tutorials
Category: Macromedia-Adobe Flash Tutorial
Author: Bilal Ghouri Date: Apr 14 2008 | Views: 139
3d Studio Max Tutorials
Category: 3d Studio Max Tutorials
Author: Bilal Ghouri Date: Apr 14 2008 | Views: 112
XHTML and CSS Stylesheets Tutorials
Category: XHTML and CSS Tutorials
Author: Bilal Ghouri Date: Apr 14 2008 | Views: 103
Windows XP tips and Tricks
Category: Windows XP Tricks
Author: Bilal Ghouri Date: Apr 14 2008 | Views: 107
My Portfolio
Category: My Portfolio
Author: Bilal Ghouri Date: Apr 14 2008 | Views: 91
PHP MySQL Tutorials
Category: PHP Mysql Tutorials
Author: Bilal Ghouri Date: Apr 14 2008 | Views: 100