php mysql data table save and edit on same page
<p>i have data table, which has 5 rows and 5 rows has save and edit options separately. on submit it is submiting in the database and page is getting refreshed. but it should not refresh and on clicking update it should be updated in the same page.
Help is appreciated.</p>

<p>Below is my code:</p>

<pre><code>&lt;?php
if(isset($_POST['save'])!="")
{
  $workname=mysql_real_escape_string($_POST['workname']);   
  $assignto=mysql_real_escape_string($_POST['name']);
  $phoneno=mysql_real_escape_string($_POST['phone_no']);
  $emailid=mysql_real_escape_string($_POST['emails']);
  $issuedate=mysql_real_escape_string($_POST['issue_date']);
  $deldate=mysql_real_escape_string($_POST['delivery_date']);
  $actualdeldate=mysql_real_escape_string($_POST['actual_delivery_date']);
  $remstrtfrm=mysql_real_escape_string($_POST['reminder_start']);
  $remtmeint=mysql_real_escape_string($_POST['reminder_time']);
  $remmsg=mysql_real_escape_string($_POST['reminder_message']);
  $wrkstat=mysql_real_escape_string($_POST['work_status']);
  $maker_id=mysql_real_escape_string($_SESSION['ADMIN_GAME_ID']);

 $create=mysql_query("INSERT INTO     dizypro_work_status_details(jobname,assign_to,phone_no,email_id,issue_date,delev    ry_date,actual_del_date,
    rem_strt_frm,reminder_time,reminder_message,work_status,maker_id,maker_date,row_    no)     VALUES('$workname','$assignto','$phoneno','$emailid','$issuedate','$deldate','$a    ctualdeldate','$remstrtfrm','$remtmeint','$remmsg','$wrkstat','$maker_id',now(),    '$row')");



 if($create)
  {
  $msg="Successfully Updated!!";
  echo "&lt;script type='text/javascript'&gt;alert('$msg');&lt;/script&gt;";
  header('Location:add-work-detail.php');
  }
  else
  {
 $errormsg="Something went wrong, Try again";
  echo "&lt;script type='text/javascript'&gt;alert('$errormsg');&lt;/script&gt;";
  }
  }

?&gt;

&lt;?php
if(isset($_POST['edit'])!="")
{
  $checkbox=mysql_real_escape_string($_POST['check']);  
  $assignto=mysql_real_escape_string($_POST['name']);
  $phoneno=mysql_real_escape_string($_POST['phone_no']);
  $emailid=mysql_real_escape_string($_POST['emails']);
  $issuedate=mysql_real_escape_string($_POST['issue_date']);
  $deldate=mysql_real_escape_string($_POST['delivery_date']);
  $actualdeldate=mysql_real_escape_string($_POST['actual_delivery_date']);
  $remstrtfrm=mysql_real_escape_string($_POST['reminder_start']);
  $remtmeint=mysql_real_escape_string($_POST['reminder_time']);
  $remmsg=mysql_real_escape_string($_POST['reminder_message']);
  $wrkstat=mysql_real_escape_string($_POST['work_status']);
  $maker_id=mysql_real_escape_string($_SESSION['ADMIN_GAME_ID']);

 $update=mysql_query("UPDATE     dizypro_work_status_details(check_box,jobname,assign_to,phone_no,email_id,issue_    date,delevry_date,actual_del_date,
    rem_strt_frm,reminder_time,reminder_message,work_status,maker_id,maker_date,row_    no)     VALUES('$checkbox','$work_name','$assignto','$phoneno','$emailid','$issuedate','        $deldate','$actualdeldate','$remstrtfrm','$remtmeint','$remmsg','$wrkstat','$mak    er_id',now(),'$row') WHERE maker_id='".$_SESSION['ADMIN_GAME_ID']."'");



 if($update)
  {
  $msg="Successfully Updated!!";
  echo "&lt;script type='text/javascript'&gt;alert('$msg');&lt;/script&gt;";
  header('Location:add-work-detail.php');
  }
  else
  {
 $errormsg="Something went wrong, Try again";
  echo "&lt;script type='text/javascript'&gt;alert('$errormsg');&lt;/script&gt;";
  }
  }

?&gt;
</code></pre>

<p>Screenshot:</p>

<p><a href="http://i.stack.imgur.com/n5kYF.png" rel="nofollow">screenshot of form</a></p>