Page 2 of 2

Re: How to update all re-sortable values of a form in a database

Posted: Tue Dec 16, 2008 5:31 am
by VladSun
:)
Sindarin wrote:

Code: Select all

//re-sort homepage news
$array_id=$_POST[itemid];
$array_value=$_POST[ordervalue];
You should not use array keys in this form. If you take a look at you error log you will see warning notices about using itemid and ordervalue:
Notice: Use of undefined constant itemid - assumed 'itemid' ....
Also, this "usage style" is vulnerable to variable-value pollution (in fact, it could be considered using global variables) - if you've previously defined

Code: Select all

define('itemid', 'my_value')
you will have a hard to debug error...

So, you should rewrite it in its strict form:

Code: Select all

//re-sort homepage news
$array_id=$_POST['itemid'];
$array_value=$_POST['ordervalue'];