For the first time I am trying to write a module....and i am stuck :(
In the admin part i am trying to make a form with a dropdown box which show's the types in the database.
At the moment i have the following code :
Code
$pntypes = testmodule_getTypesInfo();
foreach($pntypes as $k => $v) {
// Add all types to dropdown-list.
$typeinfo[] = array('id' => $k,
'metric' => $v);
}
echo "<BR>";
print_r($typeinfo);
// end get all types
$row = array();
$output->SetOutputMode(_PNH_RETURNOUTPUT);
$row[] = $output->Text("Type:");
$row[] = $output->FormSelectMultiple('type_id', $typeinfo,0,1);
$output->SetOutputMode(_PNH_KEEPOUTPUT);
$output->SetInputMode(_PNH_VERBATIMINPUT);
$output->TableAddrow($row, 'left', "top");
$output->SetInputMode(_PNH_PARSEINPUT);
foreach($pntypes as $k => $v) {
// Add all types to dropdown-list.
$typeinfo[] = array('id' => $k,
'metric' => $v);
}
echo "<BR>";
print_r($typeinfo);
// end get all types
$row = array();
$output->SetOutputMode(_PNH_RETURNOUTPUT);
$row[] = $output->Text("Type:");
$row[] = $output->FormSelectMultiple('type_id', $typeinfo,0,1);
$output->SetOutputMode(_PNH_KEEPOUTPUT);
$output->SetInputMode(_PNH_VERBATIMINPUT);
$output->TableAddrow($row, 'left', "top");
$output->SetInputMode(_PNH_PARSEINPUT);
As you can see i added an print_r($typeinfo) statement which prints the array to check if it got the data from the database.
The statement returns the following :
Code
which looks correct to me.
If i open the page it does show the dropdown box. And it shows the correct amount of options (three in this case). However it doesn't give the text in the dropdown box (type1,type2,type3).
I have been looking at this and trying things for to long...and i can't seem te find the problem.
Can someone point me in the right direction ?
