Question

$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....

Was it helpful?

Solution

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);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top