GET: we are submitting a form to login.php, when we do submit or similar
action, values are sent through visible query string (notice
./login.php?username=…&password=… as URL when executing the script
login.php) and is retrieved by login.php by $_GET['username'] and
$_GET['password'].
POST: we are submitting a form to login.php, when we do submit or
similar action, values are sent through invisible standard input (notice
./login.php) and is retrieved by login.php by $_POST['username'] and
$_POST['password'].
POST method data is sent by standard input (nothing shown in URL when
posting while in GET method data is sent through query string.
- PHP - Echo?php $myiString = "Hi!"; echo $myiString; echo "I love PHP!"; ? Display: Hi! I love PHP! A simple form example 1 2 3 Building a Form 4 5 6 " 7 method="get" 8 9 Search: 10 1… Read More
PHP Array Functionsarray_change_key_case — Changes all keys in an array array_chunk — Split an array into chunks array_combine — Creates an array by using one array for keys and another for its values array_count_values — Counts all the value… Read More
Php Directory Functionschdir — Change directory chroot — Change the root directory closedir — Close directory handle dir — Return an instance of the Directory class getcwd — Gets the current working directory opendir — Open directory handle read… Read More
Php Mysql Image upload?php // 1. Gem modtagne formulardata i variabler: $navn = $_POST['navn']; $alder = $_POST['alder']; $postnr = $_POST['postnr']; $mail = $_POST['mail']; $billede = $_FILES['profilbillede']; $password = $_POST['… Read More
PHP MySQL Functionsmysql_field_len — Returns the length of the specified field mysql_field_name — Get the name of the specified field in a result mysql_field_seek — Set result pointer to a specified field offset mysql_field_table — Get … Read More
Length of a StringThe length property of a string is determined with the strlen( ) function, which returns the number of eight-bit characters in the subject string: integer strlen(string subject) We used strlen( ) earlier in the chapter t… Read More
Defining FunctionsThere are already many functions built into PHP. However, you can define your own and organize your code into functions. To define your own functions, start out with the function statement: function some_function([argumen… Read More
PHP HTTP Functionsob_deflatehandler — Deflate output handler ob_etaghandler — ETag output handler ob_inflatehandler — Inflate output handler http_parse_cookie — Parse HTTP cookie http_parse_headers — Parse HTTP headers http_parse_message — P… Read More
PHP Date / Time Functionscheckdate — Validate a Gregorian date date_add — Alias of DateTime::add date_create_from_format — Alias of DateTime::createFromFormat date_create — Alias of DateTime::__construct date_date_set — Alias of DateTime::setDate …Read More
PHP Zip File Functionszip_close — Close a ZIP file archive zip_entry_close — Close a directory entry zip_entry_compressedsize — Retrieve the compressed size of a directory entry zip_entry_compressionmethod — Retrieve the compression meth… Read More
Including and Requiring PHP FilesTo make your code more readable, you can place your functions in a separate file. Many PHP add-ons that you download off the Internet contain functions already placed into files that you simply include in your PHP program… Read More
Creating ArraysPHP provides the array( ) language construct that creates arrays. The following examples show how arrays of integers and strings can be constructed and assigned to variables for later use: $numbers = array(5, 4, 3, 2, 1);… Read More
File Manipulation11.3. File Manipulation There may be times when you don't want to store information in a database and may want to work directly with a file instead. An example is a logfile that tracks when your application can't co… Read More
PHP Configuration DirectivesAlthough the focus of this book is application security, there are a few configuration directives with which any security-conscious developer should be familiar. The configuration of PHP can affect the behavior of the cod… Read More
Showing the Browser and IP AddressHere is a simple page that prints out the browser string and the IP address of the HTTP request. Create a file with the following content in your web directory, name it something like example.php3, and load it in your bro… Read More