-1

i have a price form like that. All the things are working but i couldnt make the total price show on next page.

       <!-- packs -->
    <div class="packs" >
                 <div class="item" id="packs-1" rel='1'
                 data-commission='2' data-price='10'>
                <span>10 usd</span>
            </div>
                  <div class="item" id="packs-2" rel='2'
                 data-commission='3' data-price='25'>
                <span>25 usd</span>
            </div>
                 <div class="item" id="packs-3" rel='3'
                 data-commission='4' data-price='50'>
                <span>50 usd</span>
            </div>
                 <div class="item" id="packs-4" rel='4'
                 data-commission='4' data-price='100'>
                <span>100 usd</span>
            </div>
                 <div class="item" id="packs-8" rel='8'
                 data-commission='4' data-price='250'>
                <span>250 usd</span>
            </div>
                 <div class="item" id="packs-12" rel='12'
                 data-commission='5' data-price='500'>
                <span>500 usd</span>
            </div>

        <div class="total">
            <span>Main Price : <b class="mainprice" id='mainprice'>0 usd</b></span>
            <span>Tax Price : <b class="taxes" id='taxes'>0 usd</b></span>
            <span class="Total" >Total Price: <b class="Total" id='Total' >0 usd</b></span>

        </div>
    </div>

here is the example how i want.

            <div class="total">
            <span>Main Price : <b class="mainprice" id='mainprice'>25 usd (total price selected) </b></span>
            <span>Tax Price : <b class="taxes" id='taxes'>2 usd (automatic calculated tax 2 usd) </b></span>
            <span class="Total" >Total Price: <b class="Total" id='Total' >27 usd (that is total price)</b></span>

        </div>

Form and tax calculate works perfectly. Just my question is how can i pass 27 usd value pass to echo another page?

here is my calculate code

<script>
$(".item").click(function() {
    var price = parseFloat($(this).attr('data-price'));
    var commission = parseFloat($(this).attr('data-commission'));
    var total = parseFloat(price) + parseFloat(commission);

    $("form[name='payment-form'] input.vds-products").val($(this).attr('rel'));
    $("#mainprice").html(price + ' usd');
    $("#taxes").html(commission + ' usd');
    $("#Total").html(total + ' usd');

});

here is all php full 3 files. Dropbox full php files

2 Answers 2

0

You can pass it with link and use get method on another page to get the total price like here Pass variable using php url

Sign up to request clarification or add additional context in comments.

2 Comments

at the end i have submit button link doesnt work for me :( or could you show me sample? another name, mail etc infos showing on next page, only that price doesnt show :(
in dropbox i put 3 php file. index.php, session.php and succes.php. all data pass another page just price doesnt :( here is the link : dropbox.com/sh/or42ojmt2mxq6gl/AAC0VjDFrxbpIdhOQJ1SvRnla?dl=0
0

Why note use session (would be my personal decision) or pass the total by post-request to the next page? Note: passing vars by post or get is dangerous, they could be manipulated. But no one is able to touch the $_SESSION var.

8 Comments

Assuming that you are using jquery to calculate the prices: Send simple POST passing your value to a file named session.php $.post( "session.php", { total: "99.99"} ); session.php contains: <?PHP session_start(); if(isset($_POST['total'])) { if(!isset($_SESSION['total'])) { $_SESSION['total'] = 0; } $_SESSION['total'] = (float)$_POST['total']; } ?>
And in your second file, do <?PHP session_start(); echo (isset($_SESSION['total']) ? $_SESSION['total'] : '0.00'); ?> dont forget to change the file extension in your secind file to .php Good luck.
index i use <?php $.post( "session.php", { total: "99.99"} ); ?> i got HTTP ERROR 500 any solution for it. :)
this is the jquery - part
okay it worked but i got echo Total 99.99 in second page:( i wanted variable price to show up 2. page :[ that user choice and price changes auto. any solution for it too :[
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.