0

I am getting error.

url.com/test.php?id=123&id2=456

This is my get.php

<?php

$id = $_GET['id'];
$id2 = $_GET['id2'];

?>

I am getting this error for 2nd parameter

instead of & url getting &amp;

Error

[23-Feb-2017 03:45:00 UTC] PHP Notice:  Undefined index: id2 in /home/xxxx/public_html/url.com/get.php on line 4
4
  • you url_encode() and url_decode() function for this Commented Feb 23, 2017 at 4:45
  • example please sir Commented Feb 23, 2017 at 4:46
  • search in google. you will find example Commented Feb 23, 2017 at 4:54
  • Read How to ask on Stackoverflow before posting a query Commented Feb 23, 2017 at 5:41

1 Answer 1

1
  try this..
   url.com/test.php?id=" . urlencode($id) . "&id2=" . urlencode($id2);

 Decode:

  $id= urldecode($_GET['id']);
  $id2= urldecode($_GET['id2']);
Sign up to request clarification or add additional context in comments.

3 Comments

header("Location: get.php?fbid=".urlencode($id)."&fname=".urlencode($id2).""); Not working still I am getting error.
error is in & char. second parameter is not getting
@vience try this code i personaly test hope it should work - $id=2; $test=3; <a href='./test.php?id=<?php echo urlencode($id); ?>&test1=<?php echo urlencode($test); ?>'>test</a> test.php <?php echo $id= urldecode($_GET['id']); echo $test= urldecode($_GET['test1']); ?>

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.