-5
$citylink_view = "view=$targetview&postevent=$_GET[postevent]";

it was showing undefined index: postevent. i solved it by using

$posteventview = $_GET['postevent'];
$citylink_view = "view=$targetview&".$posteventview;

but this is creating problems in my URL. functionality doesn't working....

  • Is `postevent` the name of a *GET* parameter or is it actually a variable in your *PHP* script? If we assume it's actually a variable we need to know what functionality doesn't work. How does your produced URL look and how do you expect it to work. `It doesn't work` is not enough information. https://developer.mozilla.org/en-US/docs/Mozilla/QA/Bug_writing_guidelines – inquam Mar 14 '13 at 09:26

1 Answers1

1

Situation before:

$citylink_view = "view=$targetview&postevent=$_GET[postevent]";

which is the same as:

$citylink_view = "view=$targetview&postevent=" . $_GET['postevent'];

Which can be written as:

$foo = $_GET['postevent'];
$citylink_view = "view=$targetview&postevent=" $foo;

You wrote:

$posteventview = $_GET['postevent'];
$citylink_view = "view=$targetview&".$posteventview;

Can you spot the difference?

Aside, you are possible vulnerable to XSS. Sanitize the input and urlencode. Use filter_* functions, e.g.:

$posteventview = filter_input(INPUT_GET, "postevent");
$citylink_view = "view=$targetview&postevent=" . urlencode($posteventview);
Lekensteyn
  • 64,486
  • 22
  • 159
  • 192