Click here to Skip to main content
15,513,489 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have parent page as data.php...

I am displaying details of all users... and when i click on p.png(named as EDIT)

it will get the cid, qid and status... to popup page which i want to edit the rest of details in a update.php page...

PHP
<?php
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>All Calls & Actions </title>

	<!-- Add jQuery library -->
	<script type="text/javascript" src="lib/jquery-1.10.2.min.js"></script>

	<!-- Add mousewheel plugin (this is optional) -->
	<script type="text/javascript" src="lib/jquery.mousewheel.pack.js?v=3.1.3"></script>

	<!-- Add fancyBox main JS and CSS files -->
	<script type="text/javascript" src="source/jquery.fancybox.pack.js?v=2.1.5"></script>
	<link rel="stylesheet" type="text/css" href="source/jquery.fancybox.css?v=2.1.5" media="screen" />

	<!-- Add Button helper (this is optional) -->
	<link rel="stylesheet" type="text/css" href="source/helpers/jquery.fancybox-buttons.css?v=1.0.5" />

</head>
<body>
<form name="" action="" method="post">
<table>
<tr>
	<th>SNo</th><th>Caller ID</th><th>Eq.ID</th><th>Nature of Complaint</th><th>Caller Name</th><th>Call Dept</th><th>Call Date & Time</th><th>Cont.Type</th><th>Status</th><th>Edit</th>
</tr>

<?php

$conn = mysql_connect("localhost","root","") or die("Unable to connect to Localhost ".mysql_error());
$db = mysql_select_db("renownan_sample") or die("Unable to Select Database ".mysql_error());
$ct = 1;
$query = "SELECT * FROM cms WHERE status!='working' ";
$exe = mysql_query($query);
while($dt=mysql_fetch_array($exe))
{
		echo "<tr>";
		echo "<td>".$ct."</td>";
		echo "<td>".$dt['callerid']."</td>";
		echo "<td>".$dt['eid']."</td>";
		echo "<td>".$dt['natureofcomp']."</td>";
		echo "<td>".$dt['callername']."</td>";
		echo "<td>".$dt['callerdept']."</td>";
		echo "<td>".$dt['cdate']."</td>";
		echo "<td>".$dt['type']."</td>";
		echo "<td>".$dt['status']."</td>";
		echo "<td>";
		echo "<a class='fancybox fancybox.iframe' href='update.php?cids=$dt[callerid]&&eid=$dt[eid]&&sts=$dt[status]'><img src='p.png' height=35px width=75px></img></a>";
		echo"</td>";
		echo"</tr>";
		$ct=$ct+1;
}
?>
</table>
</form>
</body>
</html>



When open data.php page that will display as in bellow link

data php page

Now When click on pending button the respected user cid, eid, will get in to popup page as below

pop up page


so after filling the details i'm clicking on submit button..

The details are updating correctly, but the popup doesn't closing it self..

So i want close the popup after updating the details and the parent page should refresh it self after the popup close.


The popup box code as follows

PHP
<?php
session_start();
$cd=$_GET['cids'];
$eqd=$_GET['eid'];
//echo "Values are:".$cd." && ".$eqd;
?>

<head>
<script src='jquery-1.11.2.min.js'></script>
</head>
<body>
<center>

<h2>Pending Call Details</h2>

<table border=0>
	<tr>
		<th>Caller ID:</th>	<td><?php echo $cd;	?></td>	<td>     </td><th>Eq.ID:</th>	<td><?php echo $eqd; ?></td>
	</tr>
</table>
<br>
<form action="" method="post">

<table border=0>
	
	<tr>
		<th>Nature of Complaint:</th><td><input type="text" name="d" id="d"></td>	<td>     </td><th>Caller Name:</th><td><input type="text" name="f" id="f"></td>
	</tr>	
	<tr>
	 <th>Call Dept:</th><td><input type="text" name="g" id="g" ></td>
	 	<td>     </td>
	    		<!--<th>PO Date:</th><td><input type="datetime-local" name="k" id="k"></td>-->
			<td>     </td>
	 </tr>
	  <tr>
	    	
			<th>Cont. Type:</th><td><input type="text" name="l" id="l"></td>
			<td>     </td>
			<th>Status:</th> <td><input type="text" name="n" id="n"></td>
	 </tr>
</table>
<br>
<center><input type="submit" name="pend_sub" value="Submit Pending"></center>
</form>
</center>
</body>
</html>
<?php
$dd=$cd;
if(isset($_POST['pend_sub']))
{
$noc=$_POST['d'];
$cn=$_POST['f'];
$cdept=$_POST['g'];
$type=$_POST['l'];
$status=$_POST['n'];
$dd=$cd;
$ee=$eqd;

$conn = mysql_connect("localhost","root","") or die("Unable to connect to Localhost ".mysql_error());
$db = mysql_select_db("renownan_sample") or die("Unable to Select Database ".mysql_error());
$query = "UPDATE cms SET natureofcomp='$noc', callername='$cn', callerdept='$cdept', type='$type', status='$status' WHERE callerid='$dd' and eid='$ee' ";
$exe = mysql_query($query);

	if(!$exe)
	{
		die("unable to update cms table ".mysql_error());
	}
	else
	{
		echo"Status updated added successfully"; 
	}
	
mysql_close();
}
?>


Please give a solution

Thanks in advance :)
Posted
Updated 17-Feb-15 7:28am
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900