Hi All,
Couldn’t find the answer to this so I hope I’m not duplicating. I have created a from to upload som info th my mysql database. It includes three checkboxes which seem to work but are not uploading the value to the database, it just inputs a "u". Any ideas?
Heres my code...
THE FORM
<div class="error">[+validationmessage+]</div>
<form id="upload_rules_form" name="upload_rules_form" method="post" action="[~[*id*]~]">
<div class="dropdown">
<div class="notices_title">
Document name:
</div>
<label for="name">
<input name="name" id="name" type="text" eform="name::1:"/>
</label></div>
<div class="dropdown">
<div class="notices_title">
Document type:
</div>
Standard: <input type="checkbox" name="document_type[]" value="[+Standard+]" eform="document_type::1">
Health and Safety: <input type="checkbox" name="document_type[]" value="[+Health and Safety+]">
Environment: <input type="checkbox" name="document_type[]" value="[+Environment+]">
</div>
<div class="dropdown">
<div class="notices_title">
LG number:
</div>
<label for="number">
<input name="number" id="number" type="text" eform="number::1:" />
</label></div>
<div class="dropdown">
<div class="notices_title">
PSI number:
</div>
<label for="psi_id">
<input name="psi_id" id="psi_id" type="text" eform="psi_id::1:" />
</label></div>
</form>
and THE PHP
<?PHP
function directors_rules_upload( &$fields, &$values )
{
global $modx;
// Init our array
$dbTable = array();
$dbTable[name] = $fields[name];
$dbTable[number] = $fields[number];
$dbTable[psi_id] = $fields[psi_id];
$dbTable[file_name] = $fields[file_name];
$dbTable[document_type] = $values[document_type];
// Run the db insert query
$dbQuery = $modx->db->insert($dbTable, ’directors_rules’ );
return true;
}
?>
Cheers