How to get div id value in php variable



INSERT INTO table_nameVALUES (value1, value2, value3, value4,...);

Next Lesson PHP Tutorial

How can I get this id into a PHP variable after submit a form? I need to pass the total value to a PHP variable. Please help me to solve this problem.

Total Price
Total:
0

Here is the script

     

asked Jul 7, 2016 at 10:12

How to get div id value in php variable

7

You want the value between the div tags, not the ID, correct?

Change this:

id: $(this).attr('id')

To this:

id: $(this).text()

If you want to display the value on the page do this:

Create an empty div:

Place it anywhere you want on the page.

Then change your jQuery:

}, function(response) {
    $('#saved-value').html(response);
});

answered Jul 7, 2016 at 10:22

awl19awl19

3664 silver badges10 bronze badges

5

This is how you get the id value on your package.php Page.

   

or you can just store the id in a new variable.


if you arent sure if there are any values being sent by your post you can use this.


answered Jul 7, 2016 at 10:51

1

    Table of contents
  • How to get div id into php variable?
  • How to put div id into a variable for php?
  • Use a DIV content as element variable
  • A solution to Get span id value in PHP

How to get div id into php variable?

Total Price
Total:
0
     
id: $(this).attr('id')
id: $(this).text()
}, function(response) {
    $('#saved-value').html(response);
});
   

How to put div id into a variable for php?

  foreach ($_POST as $key => $val)
    $_SESSION[$key] = $val;
$_SESSION["id"] = $emp_id
if (isset($_POST['submit'])){
    foreach ($_POST as $key => $val)
    $_SESSION[$key] = $val;
$_SESSION["id"] = $emp_id

Use a DIV content as element variable

08091
19977
$place, 'destination' => $destination, 'sensor' => 'true', 'units' => 'imperial' ); ?>
Hope the respost explains my intenshions better. 

08091
19977
$place, 'destination' => $destination, 'sensor' => 'true', 'units' => 'imperial' ); ?>
08091
//If I write '08091' here.. //I just type '08091' here....
      um_user('zipcode'),
            'destination'    => $destination,
            'sensor'        => 'true',
            'units'            => 'imperial'
        );
        
    ?>

A solution to Get span id value in PHP

  Span ID value in PHP Printed PHP variable total amount value : '.$output = $_POST['total'].''; } ?>

+

=
(Store in Span id value) Rs.