-2

I need to insert a div value into my database, as you can see down there in the code there is the called Total Amount, this is giving me the final price i will have to pay, what i want is to insert the total amount value(which depends on what you are buying) into the database, for example if i pay 90$ i want the column Payment in my table to save the price i paid. I already done some php and im gonna insert it here.

`<div class="box step6">
        <h2 class="title">Step 5: Billing contact information</h2>
        <h3>Amount:</h3> <div class="pay one"></div></br>
        <h3>Early Bird Offer:</h3> <div class="pay two"></div></br>
        <h3>Total Amount:</h3> <div class="pay three"></div>
        <div class="pay-bt">
            <div class="paypal"><h3>Paypal</h3></div>
            <div class="card"><h3>Credit Card</h3></div>
            <div class="bank"><h3>Bank Transfer</h3></div>
        </div>`

2 Answers2

0

If you want to keep the div content as html, you can use jquery JSON.stringify($(".step6").html()) to get the content and encode html chars in php to prevent XSS

Diego N.
  • 562
  • 3
  • 10
-1

Consider using ajax to send your data.

I would suggest using an ID for the div you want to target lets try #pay-three

$.ajax({
    url: '/your-php-script.php',
    type: 'POST',
    data: {
        total-amount: $('#pay-three').text(),
    }
}).done(function(data){
        alert('data sent');
});

In your script:

$total-amount=mysqli_real_escape_string($_GET['total-amount']);