Question

my operations is:

var SimTxt = "some text & some other text";
...
xmlhttp.send(&SimTxt ="+SimTxt);
...

<?php 
$SimTxt = $_POST['SimTxt'];

echo

 <button id="btn9" class="sim_btn" type="button">
 '.$simBtn10.'
 </button>

But what is printet on screen is only "some text" everything after "&" sign is removed

Was it helpful?

Solution

Your string needs to be encoded before sending :

..
var SimTxt = encodeURIComponnent("some text & some other text");
xmlhttp.send(&SimTxt ="+SimTxt);
...

-- and the string (which actually is treated as a parameter, and therefore is splitted by &), will not be treated as an URI component by PHP.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top