i need to edit data from the databse through a form.my code is below
[code=php]
<?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_regener ate_id(); //i've added these lines
$new_sessionid = session_id(); //i've added these lines
?>
<?php include_once "admin_template s/case_header.php "; ?>
<html>
<head>
<title>Untitl ed Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
$query="select * from designation where designation='Mi nister'";
$exe=caseQuery( $query);
if(mysql_num_ro ws($exe))
{
$output ='<table border="1">
<tr><td>Name</td><td>Designat ion</td><td>Date of Appointment</td><td>Phone Office</td><td>Mobile</td><td>Residenc e</td><td>District </td><td>Taluka</td>
<td>Panchayat Name</td><td>Panchaya t Address</td><td>Edit</td></tr>';
$res=@mysql_fet ch_object($exe) ;
$id=$res->sr_no;
$output .='<tr><td>'.$r es->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 designation='Mi nister'";
$resl = caseQuery($sql) ;
$result=mysql_f etch_array($res l);
$name=$result["name"];
$dsg=$result["designatio n"];
$dt=$result["dte"];
$ph_o=$result["ph_o"];
$ph_m=$result["ph_m"];
$ph_r=$result["ph_r"];
$dis=$result["district"];
$tal=$result["taluka"];
$name=$result["pan_name"];
$addr=$result["pan_addr"];
}
?>
</body>
</html>
[/code]
on clicking edit a form should appear where i can edit the details.any idea how i can go about it?
[code=php]
<?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_regener ate_id(); //i've added these lines
$new_sessionid = session_id(); //i've added these lines
?>
<?php include_once "admin_template s/case_header.php "; ?>
<html>
<head>
<title>Untitl ed Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
$query="select * from designation where designation='Mi nister'";
$exe=caseQuery( $query);
if(mysql_num_ro ws($exe))
{
$output ='<table border="1">
<tr><td>Name</td><td>Designat ion</td><td>Date of Appointment</td><td>Phone Office</td><td>Mobile</td><td>Residenc e</td><td>District </td><td>Taluka</td>
<td>Panchayat Name</td><td>Panchaya t Address</td><td>Edit</td></tr>';
$res=@mysql_fet ch_object($exe) ;
$id=$res->sr_no;
$output .='<tr><td>'.$r es->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 designation='Mi nister'";
$resl = caseQuery($sql) ;
$result=mysql_f etch_array($res l);
$name=$result["name"];
$dsg=$result["designatio n"];
$dt=$result["dte"];
$ph_o=$result["ph_o"];
$ph_m=$result["ph_m"];
$ph_r=$result["ph_r"];
$dis=$result["district"];
$tal=$result["taluka"];
$name=$result["pan_name"];
$addr=$result["pan_addr"];
}
?>
</body>
</html>
[/code]
on clicking edit a form should appear where i can edit the details.any idea how i can go about it?
Comment