-6

i am install xampp recently

i will write a function in php

$value=$_GET['value'];

but it shows an error "Undefined index"

i will also try $_REQUEST function

plse help me

mario
  • 144,265
  • 20
  • 237
  • 291
SureshKumar Vegesna
  • 1,192
  • 5
  • 19
  • 37

1 Answers1

5

It shows undefined index because you did not set the GET parameter value. If you will not always be setting it, do something like this:

$value = (isset($_GET['value'])) ? $_GET['value'] : 'default_value';

...or...

if (isset($_GET['value'])) {
  $value = $_GET['value'];
}

Essentially, you need to verify that a variable is set before you try and use it or it will generate warnings.

Anders Marzi Tornblad
  • 18,896
  • 9
  • 51
  • 66
DaveRandom
  • 87,921
  • 11
  • 154
  • 174