Hi i decided to go ahead and add changing items in my config settings dynamically so i wrote the page from scratch and im sooooo close but i just have one little issue lol...
The problem is that i need to loop two dif arrays and process each time in the loop and i cant stop the inner foreach form completing all at once while the other one is still on the first key.
Im sure that is what is happening because when i do the form submit both values end up the same value.
first here is what the form looks like basically just the text layout.
Records Per Page 15
Session Timeout 20
now here is what the post array look like. They are built in seperate input tags.
[configname] => Array
 => Records Per Page
 => Session Timeout
[configvalue] => Array
 => 15
 => 20
[csave] => csaved
[submit] => Submit
Thern here is the process.
// If request is made for config Change.
if(isset($_POST['csave'])) //this just means the form was sent
//set post arrays into own array names
$name_array = $_POST['configname'];
$val_array = $_POST['configvalue'];
//now see how many elements in name array
$elenum = count($name_array); //used for i loop max
//while both foreach are open update per value
for ($i = 1; $i <= $elenum; $i++)
foreach($name_array as $nkey=>$nvalue)
$chname = clearInput($nvalue);
foreach($val_array as $vkey=>$vvalue)
$chvalue = intval($vvalue);
$update="UPDATE config SET cvalue='$chvalue' WHERE cname='$chname'";
$resu = mysqli_query($myconnect, $update);
here is the db layout
ID cname cvalue
1 Records Per Page 5
2 Session Timeout 60
I just added the for loop a few min ago as sort of a last resort to get this to work, but i thought it was time to ask for some help with this. I was sort of thinking maybe i just need to move my forloop to inside the second foreach
yes i just confirmed that the way its looping, watever the session timeout is set to on the form is what the rec per page is set to as well.