Hi,
I have a number of checkboxes in a form, all named regions[]
on submitting the form, this section of POST:array is as it should be [regions] => Array ( [0] => North_East [1] => North_West [2] => Yorkshire_And_The_Humber [3] => Wales [4] => East_Midlands )
I have a number of database tables being writen to with similar syntax as the below(without arrays, without the autogenerated code running, queries are in onsubmit after email)they work ok, it must be the way im handling the array that is not inserting the $regions into the table. Anything obvious you can see wrong with the array?
ChronoFormsv3.0
ive searched everywhere, and tried several variations over a number of weeks, ive just not found anything that clicks and works
also, another quick one..
is it possible to use the array key as a variable such as $key, if its set in the form as say arrayname[key] ? - this could cut the code down by 1000 lines!
many thanks
peers
I have a number of checkboxes in a form, all named regions[]
on submitting the form, this section of POST:array is as it should be [regions] => Array ( [0] => North_East [1] => North_West [2] => Yorkshire_And_The_Humber [3] => Wales [4] => East_Midlands )
I have a number of database tables being writen to with similar syntax as the below(without arrays, without the autogenerated code running, queries are in onsubmit after email)they work ok, it must be the way im handling the array that is not inserting the $regions into the table. Anything obvious you can see wrong with the array?
ChronoFormsv3.0
...
$regions = array();
$regions = JRequest::getVar('regions', array(), 'post', 'array');
foreach($regions as $key=>$region) {
$query ="INSERT INTO #__sobi2_fields_data
SET fieldid = '46',
data_txt = '$region',
data_char = '',
itemid = '$sobi_id;";
$db->setQuery($query);
$db->query(); }
...
ive searched everywhere, and tried several variations over a number of weeks, ive just not found anything that clicks and works
also, another quick one..
is it possible to use the array key as a variable such as $key, if its set in the form as say arrayname[key] ? - this could cut the code down by 1000 lines!
many thanks
peers