Need Help please

Hello, I’m just new in php scripts and I make a sample registration scripts using delete and edit link, I was able to run the scripts but when I try to edit it the newly edit data is not displayin. I make some debug by myself but still the problem I cannot show the edited or update data to its right id number.

Here is the script.


<?php
session_start();
include("../../Includes/functions.inc.php");
include("../../Includes/functions.biosched.php");
include("../../connect.php");
include("../../Includes/sqlclass.php");

$q1 = new csql('test_db','SampleTable1');

if($_POST['proc']==1)
{
	$uid = $g1['id'];
        $id = $_POST['ayde'];
  	$ufn = $_POST['name'];
	$uln = $_POST['lastname'];
	
	$q1->tblcol = 'FirstName,LastName';	
	u_ms($_POST['ufn'],$_POST['uln'],$id);
	
	echo ("Your First Name is $ufn<br>");
	echo ("Your Last Name is $uln<br>");
       echo ("YOUR is $id<br>");
	
	

	 $q1->tblcol = 'FirstName,LastName';
		if( $q1->i_ms("'".$_POST['name']."','".$_POST['lastname']."'") )
	  {
		echo "INSERT APPROVED";	
	  }
	 else
		echo "INSERT FAILED";*/
}

if($_GET['delid'] != '')
{
	$q1->d_ms($_GET['delid']);
}

?>





<?php
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////                   ADD INFORMATION                     //////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
?>
<?php if($_GET['pg']==2){ ?>
<style type="text/css">
<!--
.style5 {color: #FF0000; font-weight: bold; }
-->
</style>
 
<form name="form1" method="" action="">
  <table width="275" border="1" cellpadding="0" cellspacing="1" bordercolor="#000000">
   <tr>
      <td colspan="2" bgcolor="#CCCCCC"><strong>Add Information</strong> </td>
    </tr>
    <tr>
      <th width="120" nowrap="nowrap"><strong>Enter First Name </strong></th>
      <td><div align="center"><input name="name" type="text" id="name" class="field"></td>
    </tr>
    <tr>
      <th nowrap="nowrap"><strong>Enter Last Name </strong></th>
      <td><div align="center"><input name="lastname" type="text" id="lastname" class="field"></td>
    </tr>
  </table>
    <input name="submit" type="button" id="submit" value="submit" class="button" onclick="new Ajax.Updater('content', 'Modules/<?=$_GET['fp']?>?pg=1&fp=<?=$_GET['fp']?>', {method: 'post', asynchronous:true, parameters:Form.serialize(document.form1)});">
    <input name="proc" type="hidden" id="proc" value="1">
  </p>
</form>
  <p>
  <?php } ?>  






<?php
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////              INFORMATION ACQUIRED                     //////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
?>    


	
<?php if($_GET['pg']==1){?>	
    <a href="javascript:void(0);" onclick="ajax_loadContent('content','Modules/<?=$_GET['fp']?>?pg=2&fp=<?=$_GET['fp']?>');return false">Add Information </a>
  <p>
<table width="500" border="1" cellspacing="0">
  <tr>
    <td colspan="4" bgcolor="#CCCCCC"><strong>Sample Information  </strong></td>
  <tr>
    <th width="29" nowrap="NOWRAP"><div align="center"><span class="style5">ID</span></th>
    <th width="198" nowrap="NOWRAP"><div align="center"><span class="style5">First Name</span> </th>
    <th width="110" nowrap="NOWRAP"><div align="center"><span class="style5">Last Name</span> </th>
    <th width="137" nowrap="NOWRAP"><div align="center"><span class="style5">Action</span></th>
  </tr>
  <?php
   $q1->q_ms();
   while($g1 = $q1->g_ms())
   {
    $id = $g1['id'];
   	$fn = $g1['FirstName'];
   	$ln = $g1['LastName'];
  ?>  
  <tr>
    <td><div align="center"><?=$id?></td>
    <td><div align="center"><?=$fn?></td>
    <td><div align="center"><?=$ln?></td>
    <td><div align="center"><a href="javascript:void(0);" onclick="ajax_loadContent('content','Modules/<?=$_GET['fp']?>?pg=3&fp=<?=$_GET['fp']?>&getid=<?=$g1['id']?>');return false">Edit</a> | <a href="javascript:void(0);" onclick="doYouWantTo('<?=$_GET['fp']?>?pg=1&delid=<?=$g1['id']?>&fp=<?=$_GET['fp']?>&sec=1')">Delete</a>  </tr>
  </tr>
  <?php } ?>
</table>
<?php } ?>


<?php 
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////                   ***EDIT***                          //////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if($_GET['pg']==3) {
	$q1->filter = "id = ".$_GET['getid'];
   	$q1->q_ms();
	$g1 = $q1->g_ms();
	
	$id = $g1['id'];
 	$fn = $g1['FirstName'];
   	$ln = $g1['LastName'];
?>
<form name="form1" method="" action="">
  <table width="318" border="1" cellspacing="0">
  <tr>
      <td colspan="3" bgcolor="#CCCCCC"><strong>Edit Information </strong></td>
	</tr>
    <tr>
	  <th nowrap="nowrap"><div align="center"><strong>ID </strong></th>	
      <th nowrap="nowrap"><div align="center"><strong>First Name </strong></th>
      <th nowrap="nowrap"><div align="center"><strong>Last Name </strong></th>
    </tr>
    <tr>
	  <td><div align="center"><input name="ayde" type="text" id="ayde" class="field" value="<?=$id?>" /></td>	 
	  <td><div align="center"><input name="name" type="text" id="name" class="field" value="<?=$fn?>" /></td>
      <td><div align="center"><input name="lastname" type="text" id="lastname" class="field" value="<?=$ln?>" /></td>  
  </tr>
  </table>
   	<input name="submit" type="button" id="submit" value="submit" class="button" onclick="new Ajax.Updater('content', 'Modules/<?=$_GET['fp']?>?pg=1&fp=<?=$_GET['fp']?>', {method: 'post', asynchronous:true, parameters:Form.serialize(document.form1)});">
    <input name="proc" type="hidden" id="proc" value="1">
	<input name="proc" type="hidden" id="proc" value="<?=$g1['id']?>">
  </p>
	<a href="javascript:void(0);" onclick="ajax_loadContent('content','Modules/<?=$_GET['fp']?>?pg=1&fp=<?=$_GET['fp']?>');return false"><<< Go Back</a>
  </p>
</form>
<?php } ?>

Note:
This php script is running but as I say the problem is I cannot display the newly edited/updated data. Please help.

Anything information you need just tell me I can give it to you.

Your code <input name=“name” type=“text” id=“name” class=“field”>
should have
<input name=“name” type=“text” id=“name” class=“field” value=“<?php echo $name; ?>”>

and similarly it should be for last name…

While Adding this variable you can set as blank and on submitting you can replace its value with value you get as post variable…