i have loaded the records from table into forms and used theme to show it as a table but when i am accessing these records in form_submit function , it is showing only last record what should i do to get all values from form into tht submit funtion ? when i use dpm fuction in submit function it only shows last value.

function flower_order_form($form_state,$bqid1=0) {
   $placeholders = implode(', ', array_fill(0, count($bqid1), "%d"));
   $sql = "SELECT distinct flower_order.bqid, flowers.flowertype,flower_order.nof  FROM {flower_order, flowers, cust_info} WHERE flower_order.bqid = $placeholders and flower_order.fid = flowers.fid" ;
   $rs = db_query($sql,$bqid1);
	 if ($rs) {
      $counter=1;
		  while ($data = db_fetch_object($rs)) {
           
           $form[$counter]['flowertype'] = array(
               '#title' => t('flower type'),
               '#size' => 60,
               '#maxlength' => 64,
               '#required' => TRUE,
               '#value' => $data->flowertype 
               );
           $form[$counter]['nof'] = array(
                '#type' => 'textfield',
                '#title' => t('nof'),
                '#size' => 60,
                '#maxlength' => 64,
                '#required' => TRUE,
                '#value' => $data->nof
                );
       $counter = $counter + 1 ;
   	   }
   }
  	     $form['submit'] = array(
		         '#type' => 'submit',
		         '#value' => t('Submit'),
	         );
        $form['#theme'] = 'flower_order_form';
        //dpm($form);
	       return $form;
	
};
function registration_theme() {
	$theme['flower_order_form'] = array(
       'arguments' => array('form' => array()),
  );
   return $theme;

}
function theme_flower_order_form($form) {
  //dpm($form);
	$rows = array();
	foreach (element_children($form) as $counter) {
      $row = array();
			$row[] = array('data' => drupal_render($form[$counter]['flowertype']));
			$row[] = array('data' => drupal_render($form[$counter]['nof']));
			$rows[] = $row;
	}
	 // Individual table headers.
	 $header = array();
	 //$header[] = t('bqid');
	 $header[] = t('flowertype');
	 $header[] = array('data' => t('nof'), 'class' => 'textfield');
 
	 $output = theme('table', $header, $rows);
	 $output .= drupal_render($form);
	 return $output;
  
}
function flower_order_form_submit($form_id, $form_state) {
// what to write here to get all the value from form  so that i can perform my further query. Becoz  if i am using dpm ($form_state)  it is only displaying last value of tht particular table.
  
}

CommentFileSizeAuthor
function flower.pdf99.28 KBranjeetsingh89

Comments

ranjeetsingh89’s picture

i am working Drupal 6 and need how to use loop to access all the value or i have to change my flower_order form logic.

timhilliard’s picture

Status: Active » Closed (works as designed)

Hi ranjeetsingh89,

This looks to be an issue that you are having that is not related to the Form Save project but rather a general drupal problem you need support with. Please head over to http://drupal.org/support and try the documentation or forums for help solving your problem.

Cheers,
Tim

timhilliard’s picture

Issue summary: View changes

my code is like this