Untuk mendapatkan nilai yang ditick pada checkbox dalam form
------------------------
PHP Checkbox Array
Tuesday, February 19, 2008
Posted by ayus at 5:04 PM 0 comments
Labels: array, checkbox, php, programming
Menghentikan auto update pada Adobe Acrobat
Sunday, February 10, 2008
Disabling adobe updater
Pergi Start > Run > cmd
taip ni
REG ADD "HKLM\SOFTWARE\Policies\Adobe\Acrobat Reader\8.0\FeatureLockdown" /v bUpdater /d 0 /t REG_DWORD /f
Ataupun, pada Run, taip ni terus
cmd /k REG ADD "HKLM\SOFTWARE\Policies\Adobe\Acrobat Reader\8.0\FeatureLockdown" /v bUpdater /d 0 /t REG_DWORD /f
Posted by ayus at 7:30 PM 0 comments
PHP Shorthand If Else
Tuesday, February 05, 2008
Meringkaskan IF ELSE di PHP
Basic True / False Declaration
$is_admin = ($user['permissions'] == 'admin') ? true : false;
Conditional Welcome Message
echo 'Welcome '.($user['is_logged_in'] ? $user['first_name'] : 'Guest').'!';
Conditional Items Message
echo 'Your cart contains '.$num_items.' item'.($num_items != 1 ? 's' : '').'.';
Conditional Error Reporting Level
error_reporting($WEBSITE_IS_LIVE ? 0 : E_STRICT);
Conditional Basepath
echo '.($PAGE_IS_SECURE ? 's' : '').'://mydomain.com" />';
Nested PHP Shorthand
echo 'Your score is: '.($score > 10 ? ($age > 10 ? 'Average' : 'Exceptional') : ($age > 10 ? 'Horrible' : 'Average') );
Leap Year Check
$is_leap_year = ((($year % 4) == 0) && ((($year % 100) != 0) || (($year %400) == 0)));
Conditional PHP Redirect
header('Location: '.($valid_login ? '/members/index.php' : 'login.php?errors=1')); exit();Contoh di ambil dari blog DWB
Posted by ayus at 11:05 AM 0 comments
Labels: php, shorthand if else
Array String and Select DB
Monday, February 04, 2008
* Select postgreSQL
// Contohnya kalau nak dapatkan email seseorang dari user input, code macam ini...
$username = $_POST['username'];
$email_user = $usr_mail["$username"];
// Kalau inputnya adalah MMD
// dia jadilah macam ni. $email_user = $usr_mail["MMD"];
echo "emailnya adalah ".$email_user; // emailnya adalah mmd@n.com.my
Posted by ayus at 8:33 PM 2 comments
Labels: array, php, programming