print arraySOFTWARE: phpprint_r($array); print contents of array MORE INFO:alternate if else statementSOFTWARE: php$myvar = empty($value1) ? '' : 'something'; Called the "ternary"operator. An alternate way to create if else statements in PHP. In the example, we're saying: "If $value1 is empty, then make $myvar nothing (''), otherwise, make it 'something'. In other words, the question mark is like "if then" and the colon is like "else" ... do this. MORE INFO:php formsSOFTWARE: phpThis is just a scratchy personal note: NOT to be used for general reference! Getting my noggin around the idea of using predefined variables in PHP for forms construction. Set request variables to empty if empty, value of request if set
Submit a form to itselfInteresting note that bluecloth (markdown) won't allow nested tags in code sequences yet. Supposed to be fixed in version 1.0.1 (pending).
MORE INFO: additional params for mailSOFTWARE: phpmail($to, $subject, $message, $headers, $additional_parameters); When using the mail function to send email with php, there is a fifth parameter, "additional", that you can specify which allows you to force things like "Return-Path" into the headers. Useful if you can't get all the header info you want in with the standard fourth, "additional headers" param. For example you can do something like this to force "Return-Path":
The "-f" flag represents options to sendmail. You can send other options as well. Note that the basic structure of the params is:
So most stuff you can get into $headers (like 'From: me@mysite' etc.) but a few others seem to be only accessible through the additional headers param. Return-Path is especially useful to avoid getting tagged as spam due to your server not being recognized by the recipient's system. More info on php.net MORE INFO:pretty date time formatSOFTWARE: php$ptime = date("l M jS - g\:i a", $unixtime); The date() function in php lets you designate how to make dates and times display. It takes two basic things: format, unix timestamp. (List of all format options on php.net via the reference URL for this cheat.)
Note that it expects unix format timestamp. So if you have your date in standard 00-00-0000 00:00:00 format instead, you can transform that first to unix format timestamp with strtotime() function.
Another approach is to make your select statement grab the date time out of the db pre-formatted just how you like. See: MORE INFO: http://www.php.net/manual/en/function.date.php |