-2

Iam calling a querystring value which sometimes has an '&' in it. For example :

 price_add.php?supplier_name=Devices & Services Co.&tender_id=481

In the above example in the supplier_name=Devices & Services (got a & in the supplier_name) and the operation is just taking 'Devices' instead of 'Devices & Services'. How will i solve this problem in php. Iam calling this script in the below format:

 <A onclick="window.open('comparitive_files/price_add.php?supplier_name={$supplier_name}&amp;tender_id={$tender_id}','mywindow','width=1200,height=800, scrollbars=yes, resizable=yes')" href="#">PRICE</A>
Sanju Menon
  • 625
  • 1
  • 6
  • 16

1 Answers1

0

Use javascript encodeUri() function before setting the URL. For eg.:

var url = encodeURI('price_add.php?supplier_name=Devices & Services Co.&tender_id=481');

console.info(url);

"price_add.php?supplier_name=Devices%20&%20Services%20Co.&tender_id=481"
Ashish Panwar
  • 1,118
  • 3
  • 11
  • 18