How can I store text() method value In php variable

First of All without the variable php_val how will I store the text() method value in a php variable.
Second How can I store the value of text() method in the existing php_val variable and then access the value of this variable in a new php variable.

why is the freecodecamp not showing my code in my question

Setting and reading variables is pretty basic PHP. Have you started with any PHP tutorials?

To post code, surround it with ``` lines. You can also highlight it with the mouse and click the </> button in the editor (6th from the left). Normally I have a screenshot of that button, but the screenshot thingie on this PC is wonky.

Hi dude I edit the post now have a look on the post plz

PHP and JS code should never be mixed like this. What is it you’re actually trying to do on the page?

I am actually getting a value from <p></p> tag which is coming in php variable and then I again store that value in new php variable for the $_SESSION method. I can not store the first php variable value in $_SESSION method because I outputted the first php variable with mysqli_fetch_array . So how can I store the value of text() method in new php variable or in js variable and then access the js variable value in another php varibale. Dude in the last I want to store the value of text() method in the php variable becuase I then have to use this variable in $__SESSION method. SO

There’s nothing in that code that makes any sense with relation to your use case – or any sensible use for that code whatsoever, really. I think you’d benefit from starting from first principles with a proper PHP tutorial. Try this one:

Thanks for suggestion btw.