This topic is locked

PHP_Snippet refresh??

8/7/2012 1:16:45 PM
PHPRunner General questions
W
wildwally author

Is it possible to refresh a PHP_Snippet script/table without refreshing the rest of the page? I seen where there was a way to do something of the sort using ajax - just when i try to get the name of the item I'm only retrieving the header field.
My situation is I have a form the user fills out, and a table looking at a sub table. When the user adds to the sub table they click a button which brings a small popup of the another add page. I would like the main page to refresh the sub table to include the newly added item in the sub table without the user losing their previously entered items on a whole page refresh.

C
cgphp 8/7/2012

Maybe a screenshot could also help us better understand your problem.

W
wildwally author 8/7/2012

Not able to post image.
Maybe another attempt at explainging what I have.
On the page load I have a PHP_Snippet that contains such:



global $conn;

$strSQL = "Select * From COD_Kit Where CODKID = '".$_SESSION['MasterCODKID']."' ORDER BY ID ASC";

$rs = db_query($strSQL,$conn);

if($rs)

{

echo '<table width="500" border="1" cellspacing="1" cellpadding="1" bgcolor="FFFFFF">

<tr align="center">

<th bgcolor="#5498cf">Kit Description</th>

<th bgcolor="#5498cf">Cost</th>

<th bgcolor="#5498cf">Sale Price</th>

</tr>';

while($row=db_fetch_array($rs))

{

echo '<tr align="center">

<td>'.$row["KitDescription"].'</td>

<td>'.$row["Cost"].'</td>

<td>'.$row["SalePrice"].'</td>

</tr>';

}

echo '</table>';

}


And this works great. The row above this location there is a button I inserted that is called add_kit. When the user selects that it pops up small window (CCPC_COD_add.php) without header, footer and all the other navigation items. This allows the user to enter the description, cost, sale of the item and hit save. After the item is saved the window closes (again works fine).
Is there anyway to refresh the snippet (posted above) to show the most recent item entered without refreshing the whole page. The problem I see happening is the user filling in the other fields some lengthy and with a refresh to reflect the most the kits assigned to thie main record it would lose the user entered data.
I know the whole deal with server and client side makes things a bit challenging, but maybe there's a way.