1 2 3 4 5 6 > >>   Sort: Date

How To Retrieve Input Values for Checkboxes Properly
How To Retrieve Input Values for Checkboxes Properly? - PHP Script Tips - Processing Web Forms If multiple input values are submitted with the same field name, like the case of a group of checkboxes, you should add ([]) to the end of the field name. This tells the PHP engine that multiple values are...
2016-06-26, 12317👍, 1💬

💬 2016-06-26 Donald: Thanks.

How To Avoid the Undefined Index Error
How To Avoid the Undefined Index Error? - PHP Script Tips - Processing Web Forms If you don't want your PHP page to give out errors as shown in the previous exercise, you should consider checking all expected input fields in $_REQUEST with the isset() function as shown in the example script below: &...
2007-04-23, 11262👍, 0💬

How To Merge Values of Two Arrays into a Single Array
How To Merge Values of Two Arrays into a Single Array? - PHP Script Tips - PHP Built-in Functions for Arrays You can use the array_merge() function to merge two arrays into a single array. array_merge() appends all pairs of keys and values of the second array to the end of the first array. Here is a...
2007-04-21, 9072👍, 0💬

File Upload Handling - Getting Uploaded File Information
How To Get the Uploaded File Information in the Receiving PHP Script? Once the Web server received the uploaded file, it will call the PHP script specified in the form action attribute to process them. This receiving PHP script can get the uploaded file information through the predefined array calle...
2016-06-30, 8591👍, 2💬

Octal and Decimal Numbers
I am trying to assign a variable the value of 0123, but it keeps coming up with a different number, what's the problem? If you assign a variable with a value of 0123, PHP will interpret as an octal number resulting to decimal value of 83. All numbers that preceded with a 0 (zero) will be interpreted...
2007-02-27, 8232👍, 0💬

How Large Can a Single Cookie Be
How Large Can a Single Cookie Be? - PHP Script Tips - Understanding and Managing Cookies How large can a single cookie be? The answer is depending what is the Web browser your visitor is using. Each browser has its own limit: Internet Explorere (IE): about 3904 bytes Mozilla FireFox: about 3136 byte...
2007-04-24, 7714👍, 0💬

How To Use an Array as a Queue
How To Use an Array as a Queue? - PHP Script Tips - PHP Built-in Functions for Arrays A queue is a simple data structure that manages data elements following the first-in-first-out rule. You use the following two functions together to use an array as a queue: array_push($array, $value) - Pushes a ne...
2007-04-21, 7549👍, 0💬

Tag <?= ... ?> in PHP
What does a special set of tags <?= and ?> do in a PHP script page? <?= expression ?> allows you to output the value of the specified expression into the HTML document directly.
2006-09-01, 7518👍, 0💬

How To Compare Two Strings with strcmp()
How To Compare Two Strings with strcmp()? - PHP Script Tips - PHP Built-in Functions for Strings PHP supports 3 string comparison operators, <, ==, and >, that generates Boolean values. But if you want to get an integer result by comparing two strings, you can the strcmp() function, wh...
2007-04-21, 7162👍, 0💬

Expression Evaluation
What is the value of this expression? +1-2*3/4 -0.5
2006-09-01, 7097👍, 0💬

How To Get the Minimum or Maximum Value of an Array
How To Get the Minimum or Maximum Value of an Array? - PHP Script Tips - PHP Built-in Functions for Arrays If you want to get the minimum or maximum value of an array, you can use the min() or max() function. Here is a PHP script on how to use min() and max(): <?php $array = array(5, 7, 6, 2,...
2007-04-22, 6638👍, 0💬

How To Truncate an Array
How To Truncate an Array? - PHP Script Tips - PHP Built-in Functions for Arrays If you want to remove a chunk of values from an array, you can use the array_splice($array, $offset, $length) function. $offset defines the starting position of the chunk to be removed. If $offset is positive, it is coun...
2007-04-21, 6633👍, 0💬

How To Get the Last ID Assigned by MySQL
How To Get the Last ID Assigned by MySQL? - MySQL FAQs - Managing Tables and Running Queries with PHP Scripts If you use an ID column with AUTO_INCREMENT attribute, you can use the mysql_insert_id() function to get the last ID value assigned by the MySQL server, as shown in the sample script below: ...
2007-05-11, 6546👍, 0💬

How To Set session.gc_divisor Properly
How To Set session.gc_divisor Properly? - PHP Script Tips - Understanding and Using Sessions As you know that session.gc_divisor is the frequency of when the session garbage collection process will be executed. You should set this value based on the income request traffic. Here are some suggestions:...
2007-04-18, 6444👍, 0💬

How To Dump the Contents of a Directory into an Array
How To Dump the Contents of a Directory into an Array? - PHP Script Tips - Working with Directoris and Files If you want to get the contents of a directory into an array, you can use the scandir() function. It gets a list of all the files and sub directories of the specified directory and returns th...
2007-04-23, 6384👍, 0💬

How To Build WHERE Criteria with Web Form Search Fields
How To Build WHERE Criteria with Web Form Search Fields? - MySQL FAQs - Managing Tables and Running Queries with PHP Scripts If your PHP script is linked to a Web form which takes search key words for multiple data fields. For example, your Web form asks your visitor to search for Website links with...
2007-05-11, 6381👍, 0💬

mysql_fetch_object() and mysql_fetch_array() Functions
What is the difference between mysql_fetch_object() and mysql_fetch_array() functions in PHP? mysql_fetch_object() fetches the current row of data from the query result associated with the specified result identifier. The row is returned as an object. See the example code: <?php $result = mys...
2007-02-27, 6376👍, 0💬

Where Is the Submitted Form Data Stored
Where Is the Submitted Form Data Stored? - PHP Script Tips - Processing Web Forms When a user submit a form on your Web server, user entered data will be transferred to the PHP engine, which will make the submitted data available to your PHP script for processing in pre-defined arrays: $_GET - An as...
2007-04-23, 6334👍, 0💬

How To Set session.gc_maxlifetime Properly
How To Set session.gc_maxlifetime Properly? - PHP Script Tips - Understanding and Using Sessions As you know that session.gc_maxlifetime is the session value timeout period. You should set this value based on the usage pattern of your visitors. Here are some suggestions: # Set it to 20 minutes for a...
2007-04-18, 6193👍, 0💬

How To Display a Past Time in Days, Hours and Minutes
How To Display a Past Time in Days, Hours and Minutes? - MySQL FAQs - Managing Tables and Running Queries with PHP Scripts You have seen a lots of Websites are displaying past times in days, hours and minutes. If you want to do this yourself, you can use the TIMEDIFF() SQL function. Note that the TI...
2007-05-11, 6153👍, 0💬

How To Join a List of Keys with a List of Values into an Array
How To Join a List of Keys with a List of Values into an Array? - PHP Script Tips - PHP Built-in Functions for Arrays If you have a list keys and a list of values stored separately in two arrays, you can join them into a single array using the array_combine() function. It will make the values of the...
2007-04-21, 6122👍, 0💬

How To List All Values of Submitted Fields
How To List All Values of Submitted Fields? - PHP Script Tips - Processing Web Forms If you want list all values of submitted fields, you can write a simple loop to retrieve all entries in the $_REQUEST array. Below is an improved version of processing_forms.php to list all submited input values: &a...
2007-04-23, 6067👍, 0💬

urlencode() and urldecode() Functions?
What are urlencode() and urldecode() functions in PHP? string urlencode(str) - Returns the URL encoded version of the input string. String values to be used in URL query string need to be URL encoded. In the URL encoded version: Alphanumeric characters are maintained as is. Space characters are conv...
2007-02-27, 6056👍, 0💬

Number of Days between Two Dates
How can we know the number of days between two given dates in PHP? Simple arithmetic: <?php $date1 = date('Y-m-d'); $date2 = '2006-07-01'; $days = (strtotime($date1) - strtotime($date2)) / (60 * 60 * 24); $days = (int) $days; echo "Number of days since '2006-07-01': $days"; ?>
2007-02-27, 5953👍, 0💬

1 2 3 4 5 6 > >>   Sort: Date