POST Array contents
Posted: Fri Aug 27, 2010 10:37 am
How do I POST a value across to another page?
I have an array, part of which is updated during the script, and I am looking to pass that value across when the page updates 60 seconds later.
So far I have:
I presume at this point I need to put my array data into a form, so I have:
But here I get stuck. I figure I need to change the Array so that it looks something like:
But this doesn't work. I can see a few problems, but can't see how to resolve them?
I have an array, part of which is updated during the script, and I am looking to pass that value across when the page updates 60 seconds later.
So far I have:
Code: Select all
$connections_array[] = array('server' => '123.456.789.012:3306',
'user' => $u,
'password' => $p,
'database' => 'MySQL01',
'sendmail' => '0',
'dbID' => '01'
);
//and repeat multiple times
for($i = 0; $i <sizeof($connections_array); $i++) {
//Execute MySQL Query and if result x is achieved
$connections_array[$i]['sendmail'] = '1';
Code: Select all
Print " <form name=\"SendMailState\" action=\"testPage.php\" method=\"post\">\n ";
for($a = 0; $a <sizeof($connections_array); $a++) {
$SendState = $connections_array[$a]['sendmail'];
$SendDB = $connections_array[$a]['dbID'];
print " <INPUT TYPE=\"hidden\" NAME=\"$SendDB\" VALUE=\"$SendState\"><br/>\n ";
}
print " </form>\n";
Code: Select all
$connections_array[] = array('server' => 'localhost:3306',
'user' => $u,
'password' => $p,
'database' => 'MySQL01_5083',
'sendmail' => '0',
'dbID' => '01');
if (isset($_POST['01'])) {
$connections_array[]['sendmail'] = '1';