Ajit N

Ajit N

  • 1.5k
  • 316
  • 9.6k

How to get html label text in PHP session or in variable ?

Oct 22 2019 8:33 AM
hello, i designed an html page, in that i have a lable. 
  1. <label id="lblrs"  class="mt-3">Rs.50</label>    
from lable the text which is "Rs.50" ,i want to store it in Php variable or in session.
In php i tried this below code
  1. $getrs='<script>var price = document.getElementById("lblrs").textContent;</script>';  
and this one also
  1. $getrs='<script>var price = document.getElementById("lblrs").value;</script>';  
 But i didn't get text of lable.
so help me how can i do this ? 

Answers (2)