Morning,
I found this great link:http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=1622&lngWId=8
Its works like a dream except for one little peice. I have about 5 multiple selects on my form. It keeps insert them as the word "Array"
One of the fields is like this:
<select name="ADGroups[]" size="1" multiple>
<option></option>
<option value="Dataview">Dataview</option>
<option value="Intellitrader">Intellitrader</option>
<option value="Crystal Reporting">Crystal Reporting</option>
<option value="Hyperion">Hyperion</option>
<option value="Kronos">Kronos</option>
<option value="Workbrain">Workbrain</option>
</select>
This is the class to insert the records:
class dbinsert{
var $i;
var $n;
var $fld;
var $val;
function gotcha($arr, $table){
$this->i = 0;
foreach($arr as $key => $value){
if($key != 'Submit'){
$this->fld[$this->i] = $key;
$this->val[$this->i] = "\"$value\"";
}
else{
break;
}
$this->i++;
}
$this->insert($table, $this->fld, $this->val);
}
function insert($table, $fld, $val){
$query = "INSERT INTO $table (%s) VALUES (%s)";
$query = sprintf($query, implode(",", $fld), implode(",", $val));
$result = mssql_query($query) or die;
}
}
My question is how do I make it recognize the array?
Thanks
Laura