note 75947 deleted from function.mysql-real-escape-string by danbrown

From: Date: Sat, 14 Mar 2009 15:05:35 +0000
Subject: note 75947 deleted from function.mysql-real-escape-string by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-151922@lists.php.net to get a copy of this message
Note Submitter: soundefined at gmail dot com ---- An update on Example 1428. A "Best Practice" query if (isset($_POST['product_name']) && isset($_POST['product_description']) && isset($_POST['user_id'])) { ........... } else { echo "Fill the form properly\n"; } The condition above will still put empty data into a database even though forms are empty. The condition should be corrected to code below. It checks empty fields in a form and handle errors. if (!empty($_POST['product_name']) && !empty($_POST['product_description']) && !empty($_POST['user_id'])) { ........... } else { echo "Fill the form properly\n"; }

« previous php.notes (#151922) next »