Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7681889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:26:40+00:00 2026-05-31T18:26:40+00:00

i have a variable $cartTotal in cart.php page i want to use that same

  • 0

i have a variable $cartTotal in cart.php page i want to use that same $cartTotal in another page and want to insert value of $cartTotal in table

how to do this
?

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T18:26:41+00:00Added an answer on May 31, 2026 at 6:26 pm

    There are a few ways to give a variable to anothe page, i think you don’t use any frameworks, so I’ll explain just the basic ways:

    At first, start a Session. At the very first of your script, add this:

    <?php
    session_start();
    ?>
    

    There must not be any other code before this, not even whitespace.
    So now, you can set Session-Variables like this:

    $_SESSION['cartTotal'] = $cartTotal;
    

    The Variable $_SESSION[‘cartTotal’] will now be available on every page, you can use it just like a normal variable.

    The second facility is, to give a variable to another page by it’s link with the GET-Method. E.G. set up your link like this:

    <a href="site.php?cartTutorial=<?php echo $cartTutorial ?>">Link</a>
    

    The Variable will be available in $_GET[‘cartTutorial’] but only in the next page and just by clicking this link. Also the GET-Method ist just good for simple variables, only text and numbers for example, arrays cannot be set.

    Third possibility is the POST-Method, but it just works with a form and is just interesting if you are using one.

    Simpliest possibility in my opinion is to make a session-variable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a variable that contains a 4 byte, network-order IPv4 address (this was
I have a variable of type Hashmap <String,Integer >. In this, the Integer value
I have variable: String colorName = BLUE; I want to set this color to
So let's say I have variable like this one: $q = DB::select('id')->from('reports')->where('field', '=', 'value');;
I have variable that store data datetime UTC from database. I want to make
i have variable such as 1,2,3,4 i want to count of commas in this
I am trying to have some variable properties value and use Maven profile to
I have variable in tpl file as {assign var=por value=$product.productid} How can I use
I have variable that get's value of checked radio button named: parentcheck I wanna
i have this code , i want to convert the get(title) to variable ,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.