Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.