Skip to content
Advertisement

getting html innertext in php

I want to get a innertext value in my html to store it in my php variable. So far I have this.

This is my html code. I want to get innertext value of < p > which will show a float number calculated by my Javascript.

JavaScript

In my php code I have this.

JavaScript

I get Undefined variable error. What am I doing wrong?

Advertisement

Answer

Ajax or Copy it to a hidden field on submit

$html->find("p[class=totalPrice]")[0]->innertext; is not something that works on normal form submission – it looks more like some scraping code.

JavaScript
JavaScript

PHP:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement