Please help me on the below issue, how can we can get the <span id='newText'></span> value in php. i am not able to get the value in php variable.

<script type="text/javascript">
function changeThis(){
    var formInput = document.getElementById('theInput').value;
    document.getElementById('newText').innerHTML = formInput;

You wrote: <span id='newText'></span> <br>

    echo $stri = addslashes("<span id='newText'></span>");

<input type='text' id='theInput' value='Write here' onChange='changeThis()' />
Member Avatar

UNclear what you're trying to achieve. PHP cannot accept data directly from javascript. Data from the user can be passed to the server (PHP) via form, url quereystring or ajax. If you want to pass it from javascript without form submission, you need to use ajax.