afridy — 2011-10-13T17:31:38-04:00 — #1
my html form 'company description' field sends "Computer Repair & Maintenance" value to php via ajax get method.
$description = $_POST["description"];
all i am getting is 'Computer Repair' part only. '& Maintenance' is missing.
how to solve this issue?
i just tried putting
$description =urlencode( $_POST["description"]);
nop, not working..
scallioxtx — 2011-10-13T17:47:09-04:00 — #2
you need to use encodeURIComponent in the AJAX script. When you're in the PHP you're too late, the damage is already done, because it will send your request like http://somedomain.com/?somekey=Computer Repair & Maintenance, so PHP will get array('somekey' => 'Computer Rapair ', ' Maintenance' => '');
afridy — 2011-10-13T18:05:55-04:00 — #3
Thank you !! ill try what you suggessted.
afridy — 2011-10-14T03:10:44-04:00 — #4
Works charm !!!
Thank you Scallio
var params = "name=" + encodeURIComponent(name) ;
var params = params + "&description=" + encodeURIComponent(description) ;
var params = params + "&address=" + encodeURIComponent(address) ;