Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem reloading frame with dynamic data.

Status
Not open for further replies.

dessie1981

Programmer
May 9, 2006
116
GB
Hi everyone.

I have developed an online store and i am trying to add a feature which shows how many items the user has in their basket.

I have 3 frames, main - where there is a table of results and text field with a quick add button in each row of the results.

SideFrame - Search tools

TopFrame - Show's some images and links, but also the number of items in the shopping basket.

Everytime the user adds a products i am
reloadading the top frame to refresh the "number" that the user sees.

The problem is that this seems to only work intermittently
It does not seem to reload the frame everytime.

I am using javascript to reload the frame.

<form name="myform" action = "<?echo $_SERVER['PHP_SELF'];?>?empty=1" method="POST">
<input name="Submit" type="submit" class="form-button" value="Empty Basket" OnClick="parent.topFrame.location.reload();" />
</form>


here is the php i have used to calculate the no of items in the basket.

if (count($_SESSION['quantity']) != 0)
{
$newval = 0;
foreach ($_SESSION['quantity'] as $val)
{
$newval = $val + $newval;
}
}
else
{
$newval = 0;
}


any ideas???

Regards
Dessie
 
Just make sure that all your calculations are done and your session variables are updated before your script outputs that tag.

You recommend that you take jpadie's advice and use session_write_close() before you output that tag, too.



Want the best answers? Ask the best questions! TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top