<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-size: 16px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px;"><span class="Apple-style-span" style="color: rgb(34, 34, 34); font-family: 'Lucida Grande','DejaVu Sans','Bitstream Vera Sans',Verdana,Arial,sans-serif; font-size: 13px; line-height: 18px;"><p style="border-width: 0px; background-color: transparent; font-size: 13px; margin: 0px 0px 0.692em; padding: 0px; vertical-align: baseline;">
Hi <br></p><p style="border-width: 0px; background-color: transparent; font-size: 13px; margin: 0px 0px 0.692em; padding: 0px; vertical-align: baseline;">I have wrote custom module for showing values in html format table. I have delete and edit action for every row. My delete function working but edit function not working .Whats wrong with code. What i need to do corrections for it.For editing the form i NEED TO BE get default values in form that too not getting.please help me guys</p>
<blockquote style="border-width: 0px; background-image: url("http://drupal.org/sites/all/themes/bluecheese/images/blockquote-66.png"); background-color: rgb(255, 255, 255); font-size: 13px; margin: 1.384em 40px 1.384em 20px; padding: 0px 0px 0px 30px; vertical-align: baseline; quotes: none; background-position: 0px 0px;">
<p style="border-width: 0px; background-color: transparent; font-size: 13px; margin: 0px 0px 0.692em; padding: 0px; vertical-align: baseline;"><b style="border-width: 0px; background-color: transparent; font-size: 13px; margin: 0px; padding: 0px; vertical-align: baseline;"><br>
<?php</b></p><p style="border-width: 0px; background-color: transparent; font-size: 13px; margin: 0px 0px 0.692em; padding: 0px; vertical-align: baseline;">function doctor_menu() {<br>$items = array();</p><p style="border-width: 0px; background-color: transparent; font-size: 13px; margin: 0px 0px 0.692em; padding: 0px; vertical-align: baseline;">
$items['doctor'] = array(<br>'title' => t('Doctors'),<br>'page callback' => 'doctors_list',<br>'access arguments' => array('access doctor'),<br>'type' => MENU_NORMAL_ITEM );<br>
$items['doctor/delete/%doctor_user'] = array(<br>'title' => t('Delete doctor'),<br>'page callback' => 'drupal_get_form',<br>'page arguments' => array('doctor_delete_confirm', 2),<br>
'access arguments' => array('access doctor'),<br>'type' => MENU_CALLBACK, );<br>$items['doctor/edit/%doctor_user'] = array(<br>'title' => t('Edit Form'),<br>'page callback' => 'drupal_get_form',<br>
'page arguments' => array('doctor_edit_confirm', 2),<br>'access arguments' => array('access doctor'),<br>'type' => MENU_NORMAL_ITEM,<br>);return $items;<br>}<br>function doctors_list() {<br>
$header = array(t('Doctor Name'), t('Gender'), t('Status'), t('Action'));<br>$query = "SELECT * FROM {doctor}";<br>$rs = db_query($query);<br>$row = array();<br>if ($rs) {<br>while ($data = db_fetch_object($rs)) {<br>
$gender = $data->gender;<br>$status = $data->status ;<br>$row[] = array(stripslashes(ucwords($data->firstname)) . ' ' . stripslashes(ucwords($data->lastname)), $gender, $status,<br>"<a style="border-width: 0px; background-color: transparent; font-size: 13px; margin: 0px; padding: 0px; vertical-align: baseline; color: rgb(6, 120, 190); text-decoration: none;">doctorid}'>" . t('Edit') . "</a><span class="Apple-converted-space"> </span>|<span class="Apple-converted-space"> </span><a style="border-width: 0px; background-color: transparent; font-size: 13px; margin: 0px; padding: 0px; vertical-align: baseline; color: rgb(6, 120, 190); text-decoration: none;">doctorid}'>" . t('Delete') . "</a>");<br>
}}<br>$str .= theme_table($header, $row);<br>return $str;<br>}<br>function doctor_user_load($doctorid) {<br>$query = "SELECT * FROM {doctor} WHERE doctorid = %d";<br>$rs = db_query($query, $doctorid);</p><p style="border-width: 0px; background-color: transparent; font-size: 13px; margin: 0px 0px 0.692em; padding: 0px; vertical-align: baseline;">
if ($rs) {<br>while ($data = db_fetch_object($rs)) {<br>return $data;<br>}}<br>return FALSE;<br>}<br>function doctor_delete_confirm(&$form_state, $doctor) {<br>$form['_doctor'] = array(<br>'#type' => 'value',<br>
'#value' => $doctor,);</p><p style="border-width: 0px; background-color: transparent; font-size: 13px; margin: 0px 0px 0.692em; padding: 0px; vertical-align: baseline;">return confirm_form($form,t('Are you sure you want to delete this doctor?'),<br>
isset($_GET['destination']) ? $_GET['destination'] : "doctor",t('This action cannot be undone.'),t('Delete'),t('Cancel'));}</p><p style="border-width: 0px; background-color: transparent; font-size: 13px; margin: 0px 0px 0.692em; padding: 0px; vertical-align: baseline;">
function doctor_delete_confirm_submit($form, &$form_state) {<br>$form_values = $form_state['values'];<br>if ($form_state['values']['confirm']) {<br>$doctor = $form_state['values']['_doctor'];</p>
<p style="border-width: 0px; background-color: transparent; font-size: 13px; margin: 0px 0px 0.692em; padding: 0px; vertical-align: baseline;">$query = "DELETE FROM {doctor} where doctorid=$doctor>doctorid";<br>
$rs = db_query($query);<br>drupal_set_message(t('Doctor has been deleted successfully.'));}<br>drupal_goto("doctor");<br>}<br>function doctor_edit_confirm(&$form_state,$doctor){</p><p style="border-width: 0px; background-color: transparent; font-size: 13px; margin: 0px 0px 0.692em; padding: 0px; vertical-align: baseline;">
$form = array();<br>$form['firstname']=array(<br>'#title'=>t('First Name'),<br>'#type'=>'textfield',<br>'#default_value' => $firstname );<br>$form['lastname']=array(<br>
'#title'=>t('Last Name'),<br>'#type'=>'textfield',<br>'#default_value' => $lastname);<br>$form['gender']=array(<br>'#title'=>t('Gender'),<br>'#type'=>'radios','#options' => array(t('male'), t('female')),<br>
'#default_value' => male);<br>$form['status']=array(<br>'#title'=>t('Status'),<br>'#type'=>'radios',<br>'#default_value' => active,<br>'#options' => array(t('active'), t('inactive')));<br>
return confirm_form($form,t(''),<br>isset($_GET['destination']) ? $_GET['destination'] : "doctor",<br>t(''),<br>t('Edit'),<br>t('Cancel'));}</p><p style="border-width: 0px; background-color: transparent; font-size: 13px; margin: 0px 0px 0.692em; padding: 0px; vertical-align: baseline;">
function doctor_edit_confirm_submit($form, &$form_state)<br>{<br>$form_values = $form_state['values'];<br>if ($form_state['values']['confirm']) {<br>$doctor = $form_state['values']['_doctors'];<br>
$query = "UPDATE {doctor} WHERE doctorid='$doctor->doctorid'";<br>} drupal_goto("doctor");}</p><p style="border-width: 0px; background-color: transparent; font-size: 13px; margin: 0px 0px 0.692em; padding: 0px; vertical-align: baseline;">
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Times New Roman'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><span class="Apple-style-span" style="font-family: arial; font-size: small;"><b><i style="color: rgb(0, 153, 0); font-family: 'comic sans ms',sans-serif;"><font style="color: rgb(0, 153, 0);" size="2">MAHESH GAJABAR</font></i><br style="color: rgb(0, 153, 0); font-family: 'comic sans ms',sans-serif;">
<font style="color: rgb(0, 153, 0); font-family: 'comic sans ms',sans-serif;" size="2"><i>Software Developer<br>FrontalRain Technologies,Bengaluru</i></font></b><br></span></span></p><p style="border-width: 0px; background-color: transparent; font-size: 13px; margin: 0px 0px 0.692em; padding: 0px; vertical-align: baseline;">
<br></p><p style="border-width: 0px; background-color: transparent; font-size: 13px; margin: 0px 0px 0.692em; padding: 0px; vertical-align: baseline;"><br></p></blockquote></span></span>