There's probably an obvious reason but I can't seem to find it...
I start with the $_POST array, received from a form:
array(9) {
["Name"]=>
string(3) "KTN"
["SQLServer"]=>
string(24) "10.6.11.20\VSQLI028,1433"
["Username"]=>
string(2) "GF"
["Password"]=>
string(2) "GF"
["MasterDB"]=>
string(11) "GFMaster_KN"
["Version"]=>
string(3) "4.9"
["Prod"]=>
string(1) "1"
["Monitored"]=>
string(1) "0"
["button"]=>
string(38) "updateColumnName=EnvironmentID;Value=1"
}
I get the button value from the array, and unset the button array value.
function load_POST($name) { //returns value and removes it from $_POST array. returns NULL if not existing.
$debug = 0;
if ( $debug == 1 ) {
$backtrace = backtrace();
echo __FUNCTION__."()";
echo " <i>called by ".basename($backtrace[1]['file'])."</i><br/>\n";
}
$post = NULL;
if( array_key_exists($name, $_POST) ) {
$post = urldecode($_POST[$name]);
if ( $debug == 1 ) {
echo "post $name, value: $post<br/>\n";
}
} else {
if ( $debug == 1 ) {
echo "post $name: doesn't exist<br/>\n";
}
}
unset($_POST[$name]);
return $post;
}
$_POST is now:
array( {
["Name"]=>
string(3) "KTN"
["SQLServer"]=>
string(24) "10.6.11.20\VSQLI028,1433"
["Username"]=>
string(2) "GF"
["Password"]=>
string(2) "GF"
["MasterDB"]=>
string(11) "GFMaster_KN"
["Version"]=>
string(3) "4.9"
["Prod"]=>
string(1) "1"
["Monitored"]=>
string(1) "0"
}
Then I create the object to assign the values to:
object(Environment)#1 (9) {
["EnvironmentID"]=>
NULL
["Name"]=>
NULL
["SQLServer"]=>
NULL
["Username"]=>
NULL
["Password"]=>
NULL
["MasterDB"]=>
NULL
["Version"]=>
NULL
["Prod"]=>
int(0)
["Monitored"]=>
int(0)
}
So far so good
Then, for each remaining $_POST value, I update the Object accordingly:
First one, parametername: Name, parameter: KTN
object(Environment)#1 (10) {
["EnvironmentID"]=>
NULL
["Name"]=>
string(3) "KTN"
["SQLServer"]=>
NULL
["Username"]=>
NULL
["Password"]=>
NULL
["MasterDB"]=>
NULL
["Version"]=>
NULL
["Prod"]=>
int(0)
["Monitored"]=>
int(0)
["ColumnName=EnvironmentID;Value=1"]=>
object(stdClass)#3 (1) {
["ColumnName"]=>
string(1) "1"
}
}
And there we have the problem, for some reason the button value is added to the object somehow... Any ideas?
Thanks in advance!