Nwahy Articles V3 pro

php

Sending E-mails

Sending E-mails

[L]PHP allows you to send e-mails directly from a script. -------------------------------------------------------------------------------- [color=FA0309]The PHP mail() Function[/color] The PHP mail() function is used to send emails from inside a script. [color=FA0309]Syntax[/color] [php]mail(to,subject,message,headers,parameters)[/php] [CENTER][img]images/im/mail.jpg[/img][/CENTER] [code][color=FA0309]Note[/color]: For the mail functions to be available, PHP requires an installed and working email system. The program to be used is defined by the configuration settings in the ...

تاريخ الإضافة: 20/3/2008

زيارات: 1577

Sessions

Sessions

[L]A PHP session variable is used to store information about, or change settings for a user session. Session variables hold information about one single user, and are available to all pages in one application. -------------------------------------------------------------------------------- [color=FA0309]PHP Session Variables[/color] When you are working with an application, you open it, do some changes and then you close it. This is much like a Session. The computer knows who you are. It knows when you start the application and when you end. But on the internet there is one problem: the ...

تاريخ الإضافة: 20/3/2008

زيارات: 1524

Cookies

Cookies

[L]A cookie is often used to identify a user. -------------------------------------------------------------------------------- [color=FA0309]What is a Cookie?[/color] A cookie is often used to identify a user. A cookie is a small file that the server embeds on the user's computer. Each time the same computer requests a page with a browser, it will send the cookie too. With PHP, you can both create and retrieve cookie values. -------------------------------------------------------------------------------- [color=FA0309]How to Create a Cookie?[/color] The setcookie() function is ...

تاريخ الإضافة: 20/3/2008

زيارات: 1523

File Upload

File Upload

[L]With PHP, it is possible to upload files to the server. -------------------------------------------------------------------------------- [color=FA0309]Create an Upload-File Form[/color] To allow users to upload files from a form can be very useful. Look at the following HTML form for uploading files: [code] Filename: [/code] [U]Notice the following about the HTML form above:[/U] - The enctype attribute of the tag specifies which content-type to use when submitting the form. "multipart/form-data" is used when a form requires binary data, like the ...

تاريخ الإضافة: 20/3/2008

زيارات: 2070

File Handling

File Handling

[L]The fopen() function is used to open files in PHP. -------------------------------------------------------------------------------- [color=FA0309]Opening a File[/color] The fopen() function is used to open files in PHP. The first parameter of this function contains the name of the file to be opened and the second parameter specifies in which mode the file should be opened: [php] [/php] The file may be opened in one of the following modes: [CENTER][img]images/im/file.jpg[/img][/CENTER] [code][color=FA0309]Note[/color]: If the fopen() function is unable to open the ...

تاريخ الإضافة: 20/3/2008

زيارات: 1493

Include File

Include File

[L]Server Side Includes (SSI) are used to create functions, headers, footers, or elements that will be reused on multiple pages. -------------------------------------------------------------------------------- [color=FA0309]Server Side Includes[/color] You can insert the content of a file into a PHP file before the server executes it, with the include() or require() function. The two functions are identical in every way, except how they handle errors. The include() function generates a warning (but the script will continue execution) while the require() function generates a fatal error ...

تاريخ الإضافة: 20/3/2008

زيارات: 2234

Date

Date

[L]The PHP date() function is used to format a time or a date. -------------------------------------------------------------------------------- [color=FA0309]The PHP Date() Function[/color] The PHP date() function formats a timestamp to a more readable date and time. [color=FA0309]Syntax[/color] date(format,timestamp) [U]format[/U] : Required. Specifies the format of the timestamp [U]timestamp[/U] : Optional. Specifies a timestamp. Default is the current date and time (as a timestamp) ...

تاريخ الإضافة: 20/3/2008

زيارات: 1378

$_POST

$_POST

[L]The $_POST variable is used to collect values from a form with method="post". -------------------------------------------------------------------------------- [color=FA0309]The $_POST Variable[/color] The $_POST variable is an array of variable names and values sent by the HTTP POST method. The $_POST variable is used to collect values from a form with method="post". Information sent from a form with the POST method is invisible to others and has no limits on the amount of information to send. [color=FA0309]Example[/color] [code] Enter your name: Enter your age: ...

تاريخ الإضافة: 20/3/2008

زيارات: 1559

$_GET

$_GET

[L]The $_GET variable is used to collect values from a form with method="get". -------------------------------------------------------------------------------- [color=940306]The $_GET Variable[/color] The $_GET variable is an array of variable names and values sent by the HTTP GET method. The $_GET variable is used to collect values from a form with method="get". Information sent from a form with the GET method is visible to everyone (it will be displayed in the browser's address bar) and it has limits on the amount of information to send (max. 100 ...

تاريخ الإضافة: 20/3/2008

زيارات: 1620

PHP Forms and User Input

PHP Forms and User Input

[L]The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input. -------------------------------------------------------------------------------- [color=940306]PHP Form Handling[/color] The most important thing to notice when dealing with HTML forms and PHP is that any form element in an HTML page will automatically be available to your PHP scripts. [color=FA0309]Form example:[/color] [code] Name: Age: [/code] The example HTML page above contains two input fields and a submit button. When the user fills in this form and ...

تاريخ الإضافة: 20/3/2008

زيارات: 1625

Functions

Functions

[L]The real power of PHP comes from its functions. In PHP - there are more than 700 built-in functions available. -------------------------------------------------------------------------------- [color=940306]PHP Functions[/color] In this tutorial we will show you how to create your own functions. -------------------------------------------------------------------------------- [color=940306]Create a PHP Function[/color] A function is a block of code that can be executed whenever we need it. Creating PHP functions: - All functions start with the word "function()" - Name ...

تاريخ الإضافة: 20/3/2008

زيارات: 1432

Looping

Looping

[L]Looping statements in PHP are used to execute the same block of code a specified number of times. -------------------------------------------------------------------------------- [color=940306]Looping[/color] Very often when you write code, you want the same block of code to run a number of times. You can use looping statements in your code to perform this. In PHP we have the following looping statements: - while - loops through a block of code if and as long as a specified condition is true - do...while - loops through a block of code once, and then repeats the loop as long ...

تاريخ الإضافة: 20/3/2008

زيارات: 1286

PHP Arrays

PHP Arrays

[L]An array can store one or more values in a single variable name. -------------------------------------------------------------------------------- [color=940306]What is an array?[/color] When working with PHP, sooner or later, you might want to create many similar variables. Instead of having many similar variables, you can store the data as elements in an array. Each element in the array has its own ID so that it can be easily accessed. There are three different kind of arrays: - [B]Numeric array[/B] - An array with a numeric ID key - [B]Associative array[/B] - An array ...

تاريخ الإضافة: 20/3/2008

زيارات: 1407

PHP Switch Statement

PHP Switch Statement

[L]The Switch statement in PHP is used to perform one of several different actions based on one of several different conditions. -------------------------------------------------------------------------------- [color=940306]The Switch Statement[/color] If you want to select one of many blocks of code to be executed, use the Switch statement. The switch statement is used to avoid long blocks of if..elseif..else code. [color=FA0309]Syntax[/color] [php]switch (expression) { case label1: code to be executed if expression = label1; break; case label2: code to be executed ...

تاريخ الإضافة: 20/3/2008

زيارات: 1482

PHP If...Else Statements

PHP If...Else Statements

[L]The if, elseif and else statements in PHP are used to perform different actions based on different conditions. -------------------------------------------------------------------------------- [color=940306]Conditional Statements[/color] Very often when you write code, you want to perform different actions for different decisions. You can use conditional statements in your code to do this. [B]if...else statement [/B]- use this statement if you want to execute a set of code when a condition is true and another if the condition is not true [B]elseif statement [/B]- is used with ...

تاريخ الإضافة: 20/3/2008

زيارات: 1486

PHP Operators

PHP Operators

[L]Operators are used to operate on values. -------------------------------------------------------------------------------- [color=940306]PHP Operators[/color] This section lists the different operators used in PHP. [color=940306]Arithmetic Operators[/color] [CENTER][img]images/im/op1.jpg[/img][/CENTER] [color=940306]Assignment Operators[/color] [CENTER][img]images/im/op2.jpg[/img][/CENTER] [color=940306]Comparison Operators[/color] [CENTER][img]images/im/op3.jpg[/img][/CENTER] [color=940306]Logical ...

تاريخ الإضافة: 20/3/2008

زيارات: 1433