Jump to content

Echo Functions Reverse Order


cortez creations

Recommended Posts

Hello All

New here and could use a bit of help.

 

Basically I have 2 separate functions that echo their results out in an html page.

My problem is the first function needs a value from the second function after it has run but needs to be echoed before the second for aesthetics.

 

Here's a bit of code to explain.

  <div class="bag"><br/><?php echo writeShoppingCart(); ?> </div>
<div id="contents">
<?php
echo showCart();
?>
</div>

So basically to work correctly I need showCart to finishing before calling writeShoppingCart()

I tried doing a redirect to the same page but it didn't like that.

Is there another way around this that I'm not aware of?

I suppose I could write a third function to get the value I need and call it before but I was hoping for a something a little cleaner.

 

Cheers

Link to comment
https://forums.phpfreaks.com/topic/227814-echo-functions-reverse-order/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.