hello all,
i had a page where we can see list of users and there is an option to edit them. So when we click on edit button a popup with lightbox comes and now when i edit it and press update... nothing is updating. The reason is i need to post it to same page.but if i do like that my popup is cuming like parent window..so can anyone suggest me..

here is the code of popup lightbox.

<?php
$rno=$_GET[q];
//echo $rno;
 include 'dbconnect.php';    
$sql="SELECT * FROM reg_users WHERE u_id= '$rno'";
$result=mysql_query($sql); 
 mysql_error();
 //$num=mysql_num_rows($result);
  $f1=mysql_result($result,$i,"u_id");     
  $f2=mysql_result($result,$i,"u_name");
  $f3=mysql_result($result,$i,"u_password");
?>
<html>
<head>
<form action="" method="post">
<body>
<table align="center">
<tr>
<td align="right">
<a href="javascript:TINY.box.hide()"> close </a>
</td>

</tr>
<tr>
<td align="left">    
         <b>Username:</b>  <input type="text" name="username" value="<?php echo $f2; ?>">
        </td>
    </tr>
    <tr>
        <td>
        <b> Password:</b>  <input type="text" name="password" value="<?php echo $f3; ?>">
        </td>
    </tr>
    <tr>
        <td align="center">
            <input style="background-color:#F6E3CE ;" type="submit" name="update" value="Update">
            <input style="background-color:#F6E3CE;" type="submit" name="delete" value="Delete">
        </td>
    </tr></table>
</body>
</form>
</head>
</html>
<?php
include 'dbconnect.php';
if( $_POST['update']) 
{
    $sql="update reg_users set u_name='$username',u_password='$password' where u_id='$rno'";
    $result=mysql_query($sql); 
    mysql_error();
}
if( $_POST['delete']) 
{
    $sql="delete from reg_users where u_id='$rno'";
    $result=mysql_query($sql); 
    mysql_error();
}
?>

You need javascript to check the return value of the window (true if updated), and update the content accordingly. This would mean you have to use ajax to get the new data from the server.

Btw, there is something wrong with your html. A normal layout is:

<html>
  <head>
  </head>
  <body>
    <form>
    </form>
  </body>
</html>
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.