Hi

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.

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

}
</script> 
You wrote: <span id='newText'></span> <br>
<br>
<?php

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



?>
<input type='text' id='theInput' value='Write here' onChange='changeThis()' />
</body>
</html>

Recommended Answers

All 2 Replies

Member Avatar for diafol

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.

thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.