Вопрос

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

Это было полезно?

Решение

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top