2013-08-16 64 views
1

我正在开发PHP程序。现在我想用$_GET传递'&'字符的整个字符串。但我面临着一些问题,就像它减少从字符“&” 字符串我有使用的代码如下如何通过在字符串中的字符'&'传递字符串php

$customer="Mahindra & Mahindra PVT.LTD." 
<a href="main.php?cust=". $customer."">Procceed</a> 

并在第二页中使用代码: 新veriable声明,然后在它通过URL veriable并打印变量。

$c=$_GET['customer']; 
echo $c; 

它的输出是“Hahindra”,但我想获得整个字符串。

+1

urlencode函数可能会帮助你 –

回答

4
<?php $customer="Mahindra & Mahindra PVT.LTD."; 
echo '<a href="main.php?cust="'.urlencode($customer).'">Procceed</a>'; ?> 
相关问题