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
$['#totalvalue'].click[function[] {
$.post["package.php", {
id: $[this].attr['id']
}, function[response] {
alert[response];
}];
}];
asked Jul 7, 2016 at 10:12
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:
Total Price 0
$['#totalvalue'].click[function[] { $.post["package.php", { id: $[this].attr['id'] }, function[response] { alert[response]; }]; }];
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_idif [isset[$_POST['submit']]]{ foreach [$_POST as $key => $val] $_SESSION[$key] = $val;$_SESSION["id"] = $emp_idUse a DIV content as element variable
0809119977Hope the respost explains my intenshions better.080911997708091//If I write '08091' here.. //I just type '08091' here....A solution to Get span id value in PHP
Span ID value in PHP Printed PHP variable total amount value :$[document].ready[function[]{ //iterate through each textboxes and add keyup //handler to trigger sum event $[".valsum"].each[function[] { $[this].keyup[function[]{ calSum[]; }]; }]; }]; function calSum[] { var sum = 0; //iterate through each textboxes and add the values $[".valsum"].each[function[] { //add only if the value is number if[!isNaN[this.value] && this.value.length!=0] { sum += parseFloat[this.value]; } }]; //.toFixed[] method will roundoff the final sum to 2 decimal places $["#sum"].html[sum.toFixed[2]]; $["#total"].val[sum.toFixed[2]]; }------Student Payble Fees------
Maths Fee: +
English Fee:
=[Store in Span id value] Rs. INSERT INTO table_nameVALUES [value1, value2, value3, value4,...];Next Lesson PHP Tutorial
Chủ Đề