Vince
Vince

Reputation: 21

Php url parameter error

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

Upvotes: 0

Views: 444

Answers (1)

Dee_wab
Dee_wab

Reputation: 1165

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

 Decode:

  $id= urldecode($_GET['id']);
  $id2= urldecode($_GET['id2']);

Upvotes: 1

Related Questions