1

I am developing program in PHP. Now i want to pass the whole string with '&' character using $_GET. But I'm facing some problem like it cuts the string from character '&' i have use code as below

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

and in second page use code: new veriable is declared and then passes url veriable in it and print variable.

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

its output is "Hahindra", but I want to get whole string.

1
  • 1
    urlencode function might help you Commented Aug 16, 2013 at 11:28

1 Answer 1

4
<?php $customer="Mahindra & Mahindra PVT.LTD.";
echo '<a href="main.php?cust="'.urlencode($customer).'">Procceed</a>'; ?>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.