Passing '&' in url via get method. stragne problem!

Hai folks,

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…
pls help :slight_smile:

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 [noparse]http://somedomain.com/?somekey=Computer Repair & Maintenance[/noparse], so PHP will get array(‘somekey’ => 'Computer Rapair ‘, ’ Maintenance’ => ‘’);

Thank you !! ill try what you suggessted.

Works charm !!!
Thank you Scallio :slight_smile:


	var params = "name=" + encodeURIComponent(name) ;
	var params = params + "&description=" + encodeURIComponent(description) ;
	var params = params + "&address=" + encodeURIComponent(address) ;