By codrakon on
hi All
I am trying to get the values from a form a created in drupal 6.x. i have not used this type of code to create the form
<?php
$form['cta_miniform_name'] = array(
'#type' => 'textfield',
'#size' => 20,
'#maxlength' => 40,
'#default_value' => t('Name'),
'#required' => TRUE,
);
?>
because it is too cumbersome to create the form i wanted. instead i have used code like this
<?php
function cta_admin($name = NULL) {
drupal_add_js($base_path . 'sites/all/modules/cta/formscript.js');
drupal_add_css(drupal_get_path('module', 'cta') .'/cta_style.css');
$x = 0;
$y = 0;
$outputtable = '<form id="cta-blueflag"><div id="tableresult" style="width:400px;"><table><tr><td>Name</td><td>Details</td><td>Address</td><td>Skill Area</td><tr>';
$result = db_query('SELECT * FROM {kcfblocks_blueflag} WHERE contacted = 0');
while ($data = db_fetch_object($result)){
$x = $data->memberid;
$y++;
$outputtable .= '<tr>
<td><input type="checkbox" value="' . $x . '" id="contacted' . $y . '">' . $data->name . '</td>
<td>' . $data->email . '<br/>' . $data->company . '<br/>' . $data->telephone . '<br/>' . $data->contacttype . '</td>
<td><a onclick="showhide(\'addresstable\',' . $x . ')">' . substr($data->address1, 0, 5) . '...</a>
<table class="addresstable" style="display: none;" id="addresstable'. $x . '">
<tr><td>' . $data->address1 . '</td></tr>
<tr><td>' . $data->address2 . '</td></tr>
<tr><td>' . $data->town . '</td></tr>
<tr><td>' . $data->district . '</td></tr>
<tr><td>' . $data->postcode . '</td></tr>
<tr><td>' . $data->country . '</td></tr></table>
<td><a onclick="showhide(\'skillstable\',' . $x . ')">' . substr($data->skillarea, 0, 5) . '...</a>
<table class="skillstable" style="display: none;" id="skillstable'. $x . '">
<tr><td>' . $data->skillarea . '</td></tr>
<tr><td>Skill Description<br/>' . $data->skilldescription . '</td></tr></table>';
$outputtable .= '</tr>';
}
$outputtable .= '</table></div><br/></form>';
$output = '<div id="ctaadmin">CTA Admin<br/><h3>Recent Blue Flag Membership applications</h3>' . $outputtable . '</div>' . drupal_get_form('cta_adminform');
return $output;
}
function cta_adminform(){
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
);
return $form;
}
function cta_adminform_submit(){
drupal_process_form('cta-blueflag', $form, $form_state);
dsm($form);
}
?>
as u can see im trying to get the values out of my custom HTML form but i am unable to do so...
please could somebody help me...
thanks
chris
Comments
what i am trying to retrieve
i am trying to get the values of the checkboxes on this form
You have two problems, you
You have two problems, you have declared the submit function incorrectly but the bigger problem is you are not using the form API so it really does not matter.
how to get the values using the api but not standard form code
how do i get the values of the form to be read by the api using the way i have done this form. is it possible
how do i do what i am trying to do using the api
how do you recommend i do what i am trying to do using the api?