hi,im having a problem with my code.im trying to edit data that im retrieving from my database tables.but im unable to submit the data after editing it.my code is shown below

<?php
require_once "../inc/functions.php";
require_once "../inc/vars.inc.php";
sessionCheck();
session_start();

$old_sessionid = session_id(); //i've added these lines

session_regenerate_id(); //i've added these lines

$new_sessionid = session_id(); //i've added these lines
function getdsgType(){
	global $desig;
	$output = '<select name="dsgn" id="dsgn">';
	$output .= '<option value="">Designation</option>';	
	foreach($desig as $k=> $v){
		if($_POST['dsgn'] == $k){
			$output .= '<option value="'.$k.'" selected>'.$v.'</option>';
		}else{
			$output .= '<option value="'.$k.'">'.$v.'</option>';		
		}
	}
	$output .= '</select>';
	return $output;
}
?>

<?php include_once "admin_templates/case_header.php"; ?>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?php
$query="select * from designation where designation='Minister'";
$exe=caseQuery($query);
if(mysql_num_rows($exe))
{
$output ='<table  border="1">
<tr><td>Name</td><td>Designation</td><td>Date of Appointment</td><td>Phone Office</td><td>Mobile</td><td>Residence</td><td>District</td><td>Taluka</td>
<td>Panchayat Name</td><td>Panchayat Address</td><td>Edit</td></tr>';
$res=@mysql_fetch_object($exe);
$id=$res->sr_no;
$output .='<tr><td>'.$res->name.'</td><td>'.$res->designation.'</td><td>'.$res->dte.'</td><td>'.$res->ph_o.'</td><td>'.$res->ph_m.'</td><td>'.$res->ph_r.'</td><td>'.$res->district.'</td><td>'.$res->taluka.'</td><td>'.$res->pan_name.'</td><td>'.$res->pan_addr.'</td><td><a href="info.php?cmd=edit&id=$id">Edit</a></td></tr>';

}
$output .= '</table>';
echo "$output";

if($_GET["cmd"]=="edit")
{
$sql="select * from designation where sr_no='".$id."'";
    $resl = caseQuery($sql);
	$result=mysql_fetch_array($resl);
	$id=$result["sr_no"];
	$name=$result["name"];
	$dsg=$result["designation"];
	$dt=$result["dte"];
	$ph_o=$result["ph_o"];
	$ph_m=$result["ph_m"];
	$ph_r=$result["ph_r"];
	
	echo "<form ENCTYPE=\"multipart/form-data\" action=\"".$_SERVER['PHP_SELF']."\" method=\"post\" name=\"src_frm\">";
  
    echo "<input type=\"hidden\" value=\"".$result["sr_no"]."\" maxlength=\"64\" readonly name=\"id\" size=\"25\" /><br />";
 
    echo "Name:";
    echo "<input type=\"text\" value=\"".$result["name"]."\" maxlength=\"64\" name=\"name\" size=\"25\" /><br />";
    echo "<br/>";
 
    echo "Designation:";
    $query=caseQuery("select designation from dsg");
    echo "<select name='dsgn' ><option value=''>Select one</option>";
    while($noticia = mysql_fetch_array($query)) { 
    echo  "<option value='$noticia[designation]'>$noticia[designation]</option>";
     }
    echo "</select>";
    echo "<br/>";
    echo "<br/>";
 
    echo "Phone office:";
    echo "<input type=\"text\" value=\"".$result["ph_o"]."\" maxlength=\"64\" name=\"office\" size=\"25\" /><br />";
    echo "<br/>";
  
    echo "Mobile:";
    echo "<input type=\"text\" value=\"".$result["ph_m"]."\" maxlength=\"64\" name=\"mobile\" size=\"25\" /><br />";
    echo "<br/>";
 
    echo "Residence:";
    echo "<input type=\"text\" value=\"".$result["ph_r"]."\" maxlength=\"64\" name=\"res\" size=\"25\" /><br />";
    echo "<br/>";
    echo "<button type=\"submit\" name=\"submit\">Update</button>";
    echo "</form>";

    echo "PLEASE LEAVE THE MOBILE NUMBER AND RESIDENCE NUMBER FIELD BLANK IF THERE IS NO NUMBER.<br/>";
	
	
    if($_POST['submit']){
    $id=escape($_POST['id']);
    $name = escape($_POST['name']);
	$desg = escape($_POST['dsgn']);	
	$ph_o= escape(trim($_POST['office']));
	$ph_mob = escape($_POST['mobile']);
	$ph_res = escape($_POST['res']);
	echo "$id";
	$errCnt = 0;
	if(!$name)
	{
	$msg[] = "<h5>PLEASE ENTER A NAME</h5>";
	$errCnt++;
	}
	else
	if(!ctype_alpha($name))
	{$msg[] = "<h5>YOU CAN ENTER ONLY ALPHABETS</h5>";
	$errCnt++;
	}

	
	if(!$desg)
	{
	$msg[] = "<h5>PLEASE SELECT A DESIGNATION</h5>";
	$errCnt++;;
	}
	
	
	if(!$ph_o)
	{
	$msg[] = "<h5>PLEASE ENTER THE OFFICE PHONE NUMBER</h5>";
	$errCnt++;
	}
	else
    if(!is_numeric($ph_o))
	{
	$msg[] = "<h5>THE OFFICE PHONE NUMBER CAN ONLY HAVE NUMBERS</h5>";
	$errCnt++;
	}

	
	if(!$ph_mob)
	{
	$ph_mob="---- ";
	}
	else if(!is_numeric($ph_mob))
	{
	$msg[] = "<h5>THE MOBILE NUMBER CAN ONLY HAVE NUMBERS</h5>";
	$errCnt++;
	}
	
	if(!$ph_res)
	{
	$ph_res="----";
	}
	else if(!is_numeric($ph_res))
	{
	$msg[] = "<h5>THE RESIDENCE NUMBER CAN ONLY HAVE NUMBERS</h5>";
	$errCnt++;
	}

	$check="SELECT * FROM dsg, designation WHERE dsg.dsg_id BETWEEN 1 AND 7 AND designation.pan_name='".$vil_n."'
     AND dsg.designation = designation.designation";
	$chk=caseQuery($check);
	if(mysql_num_rows($chk))
	{
	$message= "you already have a entry for this panchayat";
	}

	if($errCnt == 0 && !message){
	$sql='UPDATE `designation` SET  `name`="'.$name.'",`designation`="'.$desg.'",`ph_o`="'.$ph_o.'", `ph_m`="'.$ph_mob.'",`ph_r`="'.$ph_res.'" WHERE sr_no="'.$id.'"';

			$dist = caseInsertQuery($sql);
			if($dist)
			{
			$ms= "<b>THE DATA HAS BEEN ADDED SUCCESFULLY</b>";
			}
			else
			{
			$ms= "<b>THE DATA COULD NOT BE ADDED</b>";
			}
			}
			else
			{
			$msgs = addslashes(@implode("<br>",$msg));
			}
	}
echo "$msgs";
echo "$ms";
echo "$message";
	 }
	


?>

</body>
</html>

please tell me where i m going wrong!

i even tried to use

if (isset($_POST['submit']) && $_POST['submit'] == "Update")

but nothing happens.i dnt kno where im going wrong

You have

if(isset($_POST['submit']))

inside

if($_GET["cmd"]=="edit")

You get the form, update the details, etc etc. All fine up to this stage. But when you click on submit, the form submits to

$_SERVER['PHP_SELF']

ie., info.php .
It will never enter the first condition of

if($_GET["cmd"]=="edit")

and it never enters

if(isset($_POST['submit']))

thanx alot.any idea how else i could go about this?

Just put the condition

if(isset($_POST['submit']))

outside

if($_GET["cmd"]=="edit")

ie.,

if($_GET["cmd"]=="edit") {
//blah blah blah
}
if(isset($_POST['submit'])) {
//blah blah blah
}

Cheers!

i did it.but the data still doesnot get updated.and there is another problem-if i click on the submit button n say i hvnt entered some details properly,my custom error gets displayed,but the form is not shown.i need the form to be seen so that the error can be corrected.

i tried another code that i found on the net but this code is giving me a problem with the id value that im tying to pass.my code is

<?php
require_once "../inc/functions.php";
require_once "../inc/vars.inc.php";
sessionCheck();
session_start();

$old_sessionid = session_id(); //i've added these lines

session_regenerate_id(); //i've added these lines

$new_sessionid = session_id(); //i've added these lines
function getdsgType(){
	global $desig;
	$output = '<select name="dsgn" id="dsgn">';
	$output .= '<option value="">Designation</option>';	
	foreach($desig as $k=> $v){
		if($_POST['dsgn'] == $k){
			$output .= '<option value="'.$k.'" selected>'.$v.'</option>';
		}else{
			$output .= '<option value="'.$k.'">'.$v.'</option>';		
		}
	}
	$output .= '</select>';
	return $output;
}
?>

<?php include_once "admin_templates/case_header.php"; ?>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?php

if(!isset($cmd)) 
{
   //display all the news
   $result = caseQuery("SELECT * 
FROM dsg, designation
WHERE dsg.dsg_id
BETWEEN 1 
AND 7 
AND dsg.designation = designation.designation order by dsg.dsg_id"); 
   if(mysql_num_rows($result))
{
$output ='<table  border="1">
<tr><td>no</td><td>Name</td><td>Designation</td><td>Phone Office</td><td>Mobile</td><td>Residence</td><td>Edit</td></tr>';
while($r=mysql_fetch_array($result)) 
   { 
      //grab the title and the ID of the news
      $name=$r["name"];//take out the title
      $dsg=$r["designation"];//take out the id
      $ph_o=$r["ph_o"];
	   $ph_m=$r["ph_m"];
	    $ph_r=$r["ph_r"];
		$id=$r["sr_no"];
$output .='<tr><td>'.$id.'</td><td>'.$name.'</td><td>'.$dsg.'</td><td>'.$ph_o.'</td><td>'.$ph_m.'</td><td>'.$ph_r.'</td><td><a href="edit.php?cmd=edit&id=$id">Edit</a></td></tr>';
}
$output .= '</table>';
echo "$output";
}
}
?>

<?
if($_GET["cmd"]=="edit" || $_POST["cmd"]=="edit")
{
   if (!isset($_POST["submit"]))
   {
      $id = $_GET["id"];
	  echo "$id";
      $sql = "SELECT * 
FROM dsg, designation
WHERE dsg.dsg_id
BETWEEN 1 
AND 7 
AND dsg.designation = designation.designation WHERE designation.sr_no=$id";
      $result = caseQuery($sql);        
      $myrow = mysql_fetch_array($result);
      ?>
	  
      <form action="edit.php" method="post">
      <input type=hidden name="id" value="<?php echo $myrow["sr_no"] ?>">
   
      Name:<INPUT TYPE="TEXT" NAME="name" VALUE="<?php echo $myrow["name"] ?>" SIZE=30><br>
      Designation:<?php
  $query=caseQuery("select designation from dsg");
echo "<select name='dsgn' ><option value=''>Select one</option>";
while($noticia = mysql_fetch_array($query)) { 
echo  "<option value='$noticia[designation]'>$noticia[designation]</option>";
}
echo "</select>";


?></TEXTAREA><br>
     Phone Office:<INPUT TYPE="TEXT" NAME="ph_o" VALUE="<?php echo $myrow["ph_o"] ?>" SIZE=30><br>
    Phone Mobile:<INPUT TYPE="TEXT" NAME="ph_m" VALUE="<?php echo $myrow["ph_m"] ?>" SIZE=30><br>
	 Phone Residence:<INPUT TYPE="TEXT" NAME="ph_r" VALUE="<?php echo $myrow["ph_r"] ?>" SIZE=30><br>
      <input type="hidden" name="cmd" value="edit">
   
      <input type="submit" name="submit" value="submit">
   
      </form>
   
   <? } ?>
   
   <?
   if ($_POST["$submit"])
   {
      $name = $_POST["name"];
      $dsgn = $_POST["dsgn"];
      $ph_o = $_POST["ph_o"];
	  $ph_m = $_POST["ph_m"];
      $ph_r = $_POST["ph_r"];

      $sql = "UPDATE designation SET name='$name',designation='$dsgn',ph_o='$ph_o',ph_m='$ph_m',ph_r='$ph_r' WHERE sr_no=$id";

      $result = mysql_query($sql);
      echo "Thank you! Information updated.";
   }
}
?>


</body>
</html>

please please help me.i need to make this work urgently

i tried another code that i found on the net but this code is giving me a problem with the id value that im tying to pass.my code is

<?php
require_once "../inc/functions.php";
require_once "../inc/vars.inc.php";
sessionCheck();
session_start();

$old_sessionid = session_id(); //i've added these lines

session_regenerate_id(); //i've added these lines

$new_sessionid = session_id(); //i've added these lines
function getdsgType(){
	global $desig;
	$output = '<select name="dsgn" id="dsgn">';
	$output .= '<option value="">Designation</option>';	
	foreach($desig as $k=> $v){
		if($_POST['dsgn'] == $k){
			$output .= '<option value="'.$k.'" selected>'.$v.'</option>';
		}else{
			$output .= '<option value="'.$k.'">'.$v.'</option>';		
		}
	}
	$output .= '</select>';
	return $output;
}
?>

<?php include_once "admin_templates/case_header.php"; ?>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?php

if(!isset($cmd)) 
{
   //display all the news
   $result = caseQuery("SELECT * 
FROM dsg, designation
WHERE dsg.dsg_id
BETWEEN 1 
AND 7 
AND dsg.designation = designation.designation order by dsg.dsg_id"); 
   if(mysql_num_rows($result))
{
$output ='<table  border="1">
<tr><td>no</td><td>Name</td><td>Designation</td><td>Phone Office</td><td>Mobile</td><td>Residence</td><td>Edit</td></tr>';
while($r=mysql_fetch_array($result)) 
   { 
      //grab the title and the ID of the news
      $name=$r["name"];//take out the title
      $dsg=$r["designation"];//take out the id
      $ph_o=$r["ph_o"];
	   $ph_m=$r["ph_m"];
	    $ph_r=$r["ph_r"];
		$id=$r["sr_no"];
$output .='<tr><td>'.$id.'</td><td>'.$name.'</td><td>'.$dsg.'</td><td>'.$ph_o.'</td><td>'.$ph_m.'</td><td>'.$ph_r.'</td><td><a href="edit.php?cmd=edit&id=$id">Edit</a></td></tr>';
}
$output .= '</table>';
echo "$output";
}
}
?>

<?
if($_GET["cmd"]=="edit" || $_POST["cmd"]=="edit")
{
   if (!isset($_POST["submit"]))
   {
      $id = $_GET["id"];
	  echo "$id";
      $sql = "SELECT * 
FROM dsg, designation
WHERE dsg.dsg_id
BETWEEN 1 
AND 7 
AND dsg.designation = designation.designation WHERE designation.sr_no=$id";
      $result = caseQuery($sql);        
      $myrow = mysql_fetch_array($result);
      ?>
	  
      <form action="edit.php" method="post">
      <input type=hidden name="id" value="<?php echo $myrow["sr_no"] ?>">
   
      Name:<INPUT TYPE="TEXT" NAME="name" VALUE="<?php echo $myrow["name"] ?>" SIZE=30><br>
      Designation:<?php
  $query=caseQuery("select designation from dsg");
echo "<select name='dsgn' ><option value=''>Select one</option>";
while($noticia = mysql_fetch_array($query)) { 
echo  "<option value='$noticia[designation]'>$noticia[designation]</option>";
}
echo "</select>";


?></TEXTAREA><br>
     Phone Office:<INPUT TYPE="TEXT" NAME="ph_o" VALUE="<?php echo $myrow["ph_o"] ?>" SIZE=30><br>
    Phone Mobile:<INPUT TYPE="TEXT" NAME="ph_m" VALUE="<?php echo $myrow["ph_m"] ?>" SIZE=30><br>
	 Phone Residence:<INPUT TYPE="TEXT" NAME="ph_r" VALUE="<?php echo $myrow["ph_r"] ?>" SIZE=30><br>
      <input type="hidden" name="cmd" value="edit">
   
      <input type="submit" name="submit" value="submit">
   
      </form>
   
   <? } ?>
   
   <?
   if ($_POST["$submit"])
   {
      $name = $_POST["name"];
      $dsgn = $_POST["dsgn"];
      $ph_o = $_POST["ph_o"];
	  $ph_m = $_POST["ph_m"];
      $ph_r = $_POST["ph_r"];

      $sql = "UPDATE designation SET name='$name',designation='$dsgn',ph_o='$ph_o',ph_m='$ph_m',ph_r='$ph_r' WHERE sr_no=$id";

      $result = mysql_query($sql);
      echo "Thank you! Information updated.";
   }
}
?>


</body>
</html>

please please help me.i need to make this work urgently

If you hover on edit hyperlink, you will see, variable $id is not 'expanded' by php as it is in single quote. While echoing a variable, always use double quotes.
For example,

echo '<a href="info.php?cmd=edit&id=$id">Edit</a>';

doesn't work, whereas the following works.

echo "<a href='info.php?cmd=edit&id=$id'>Edit</a>";

:)

but i want to put the edit link within <td> and if i use that format i get an error!

The point I was trying to make here was to show you how to use single and double quotes. http://php.net/manual/en/language.types.string.php

The variable $id is not expanding and hence you are facing problem with the id value that you are trying to pass. Read the above link to know more on what I am talking about.

when im initially searching for the data,i want to display the data in a table.and i want to give a edit link in each row.so how do i put the edit link within the <td> tags?

ok...im sorry for all the stupid qts.im new to php so having loads of problems.i managed to fix the single quotes.and now my old problem has started again.after the edit the details and click the submit button,the data doesno get updated.my modified code is below

<?php
require_once "../inc/functions.php";
require_once "../inc/vars.inc.php";
sessionCheck();
session_start();

$old_sessionid = session_id(); //i've added these lines

session_regenerate_id(); //i've added these lines

$new_sessionid = session_id(); //i've added these lines
function getdsgType(){
	global $desig;
	$output = '<select name="dsgn" id="dsgn">';
	$output .= '<option value="">Designation</option>';	
	foreach($desig as $k=> $v){
		if($_POST['dsgn'] == $k){
			$output .= '<option value="'.$k.'" selected>'.$v.'</option>';
		}else{
			$output .= '<option value="'.$k.'">'.$v.'</option>';		
		}
	}
	$output .= '</select>';
	return $output;
}
?>

<?php include_once "admin_templates/case_header.php"; ?>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<?php

if(!isset($cmd)) 
{
   //display all the news
   $result = caseQuery("SELECT * 
FROM dsg, designation
WHERE dsg.dsg_id
BETWEEN 1 
AND 7 
AND dsg.designation = designation.designation order by dsg.dsg_id"); 
   $rows=mysql_num_rows($result);
   if($rows)
{
echo "<div style='padding-left:20px;'><table style='border-collapse:collapse; border-color:#000' border='1' cellspacing='0' cellpadding='5' width='400'>";
		echo "<tr><td width='150'>Id</td><td width='100'>Name</td><td width='60'>Designation</td><td width='150'>Office</td><td width='150'>Mobile</td><td width='150'>Res</td><td>Edit</td></tr>";
		for($i=1;$i<=$rows;$i++) {
			$r=mysql_fetch_array($result); 
		$id=$r["sr_no"];
echo "<tr><td>{$r['sr_no']}</td><td>{$r['name']}</td><td>{$r['designation']}</td><td>{$r['ph_o']}</td><td>{$r['ph_m']}</td><td>{$r['ph_r']}</td><td><a href='edit.php?cmd=edit&id=$id'>Edit</a></td></tr>";
		echo "";
		}
		echo "</table></div>";
}}
?>

<?
if($_GET["cmd"]=="edit" || $_POST["cmd"]=="edit")
{
   if (!isset($_POST["submit"]))
   {
      $id = $_GET["id"];
	  echo "$id";
      $sql = "SELECT * FROM  designation WHERE sr_no=$id";
      $result = caseQuery($sql);        
      $myrow = mysql_fetch_array($result);
      ?>
	  
      <form action="edit.php" method="post">
      <input type=hidden name="id" value="<?php echo $myrow["sr_no"] ?>">
   
      Name:<INPUT TYPE="TEXT" NAME="name" VALUE="<?php echo $myrow["name"] ?>" SIZE=30><br>
      Designation:<?php
  $query=caseQuery("select designation from dsg");
echo "<select name='dsgn' ><option value=''>Select one</option>";
while($noticia = mysql_fetch_array($query)) { 
echo  "<option value='$noticia[designation]'>$noticia[designation]</option>";
}
echo "</select>";


?></TEXTAREA><br>
     Phone Office:<INPUT TYPE="TEXT" NAME="ph_o" VALUE="<?php echo $myrow["ph_o"] ?>" SIZE=30><br>
    Phone Mobile:<INPUT TYPE="TEXT" NAME="ph_m" VALUE="<?php echo $myrow["ph_m"] ?>" SIZE=30><br>
	 Phone Residence:<INPUT TYPE="TEXT" NAME="ph_r" VALUE="<?php echo $myrow["ph_r"] ?>" SIZE=30><br>
      <input type="hidden" name="cmd" value="edit">
   
      <input type="submit" name="submit" value="submit">
   
      </form>
   
   <? } ?>
   
   <?
   if ($_POST["$submit"])
   {
      $name = $_POST["name"];
      $dsgn = $_POST["dsgn"];
      $ph_o = $_POST["ph_o"];
	  $ph_m = $_POST["ph_m"];
      $ph_r = $_POST["ph_r"];

      $sql = "UPDATE designation SET name='$name',designation='$dsgn',ph_o='$ph_o',ph_m='$ph_m',ph_r='$ph_r' WHERE sr_no=$id";

      $result = mysql_query($sql);
      echo "Thank you! Information updated.";
   }
}
?>


</body>
</html>

You have a typo.

if ($_POST["$submit"])
{

should be

if ($_POST["submit"])
   {

And please indent your code. Indented code is easier to debug and find faults.

thank you sooooo much.that solved the problem.but nw i have another problem:(
once i edit the data the data is not reflected in the table.i want the changed data to be shown immediately after clicking submit.also once the data is updated and i refresh the page the updated row is not shown!

sorry bout that.my row is was not showins because i wasnot selecting a value from the databse.fixed that.
but still dont know how to display the new results once i update the data.can you help me please?

ok sorry sorry...fixed that as well.thank you soo much for all your help!!

Great :) Good job.

Cheers!

can you tell me how i can populate my designation drop down to show the value that is stored in the database?i have about 20values in the designation table

Eg.

<?php
$rec_in_table = 2;
?>
<select name='designation'>
<option value='1' <?php if($rec_in_table == 1) { echo "selected"; } ?>>1</option>
<option value='2' <?php if($rec_in_table == 2) { echo "selected"; } ?>>2</option>
<option value='3' <?php if($rec_in_table == 3) { echo "selected"; } ?>>3</option>
</select>

fixed that as well.thank you soo very much for all your help.you are a real saviour!!:)

i did it like dis

Designation:<?php
  $query=caseQuery("select designation from dsg");
echo "<select name='dsgn' >";
while($noticia = mysql_fetch_assoc($query)) { 
echo  "<option value='$noticia[designation]'>$noticia[designation]</option>";
}
echo "</select>";
?>

it worked:)

You are welcome! Glad I could help. :)

Edit:

I am not really sure how the above code worked. Technically, It shouldn't because nothing is selected yet. :S

hey can any tell me how i can store that data that i retrieve from the database into a array?i tried the foll

$quer=caseQuery("select designation from dsg");
	  while(($rows = mysql_fetch_assoc($quer)))
	    {   $info[] = $rows;  }

but $info just holds 'array'.any idea how i can do it?

$info[] = $row['columnname'];

tried that

<?php
	  $quer=caseQuery("select designation from dsg");
	  while(($rows = mysql_fetch_assoc($quer)))
	  {   $info[] = $row['designation'];
	   }
		//print_r(array_values($info)); 
	  //$info=mysql_fetch_array($quer);
	 //$info = array('Minister','Secretary','Director of Panchayats', 'Addl Director of Panchayats(North)'); 

$query = caseQuery("SELECT designation from designation where sr_no=$id") or die(mysql_error()); 

while ($row = mysql_fetch_assoc($query)) 
{ 

echo '<select name="dsgn">'; 

foreach ($info as $data) 
{ 
echo '<option'.($row['designation']==$data? ' selected' : '').'>'.$data.'</option>'; 
} 

echo '</select>'; 

}

doesnot work.now the drop down is blank

hey,it worked.thank you thank you thank you soooo much!!

If you have no more questions to ask, please mark this thread as solved. :)

Cheers,
Naveen

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.