I have the following module

<?php
drupal_add_css(drupal_get_path('module', 'edit_account') .'/edit_account.css', 'module', 'all', TRUE);

function edit_account_block($op = 'list', $delta = 0)
{
if ($op == 'list')
{
$blocks[0]['info'] = t('edit_account Block');
return $blocks;
}
else if ($op == 'view')
{
$block['subject'] = t('edit_account Block');
$block['content'] = edit_account_form();
return $block;
}
}

function edit_account_form()
{
$form = array();
if($_SESSION['utype']=="Franchisor")
{
$sql="select * from {franchisor_reg} where email_id = '". $_SESSION['username'] . "'";
$result=db_query($sql);

while ($rs = db_fetch_object($result))
{
$form['efirst_name'] = array(
'#type' => 'textfield',
'#title' => t('First Name'),
'#default_value' => $rs->first_name,
'#maxlength' => 128,
'#required' => TRUE,
);

}

return system_settings_form($form);

}
if($_SESSION['utype']=="Franchise")
{
$sql="select * from {franchise_reg} where email_id = '". $_SESSION['username'] . "'";
$result=db_query($sql);
while ($rs = db_fetch_object($result))
{

}
}

}

It is returning "Array" only

please help me

Regards

Kumar

Comments

kannan@kiluvai.com’s picture

You can't just call the form function in the block content, you need to call the drupal_get_form() to render the form

your code must be like this


$block['content'] = drupal_get_form('edit_account_form');

refer this http://api.drupal.org/api/file/developer/topics/forms_api.html

comterkumar’s picture

Thank you .. It is working now