html - Notice: Undefined index: picCat in E:\xampp\htdocs\Evako\admin.php on line 313 -


if not in form choose category returns error :

notice: undefined index: piccat in e:\xampp\htdocs\evako\admin.php on line 313

code: form

<form class="form" method="get">             <input type="text" id="nmpic" name="nmpic" placeholder="име на снимката" onfocus="this.placeholder = ''" onblur="this.placeholder = 'име на снимката'"></br>                 <input type="text" id="price" class="pricefrom" name="pricefrom" placeholder="цена от" onfocus="this.placeholder = ''" onblur="this.placeholder = 'цена от'">                 <input type="text" id="price" class="priceto" name="priceto" placeholder="цена до" onfocus="this.placeholder = ''" onblur="this.placeholder = 'цена до'"></br>                 <select name="piccat" id="piccat">                     <option value="" selected disabled>Изберете категория</option>                     <option>Детски</option>                     <option>Сватби</option>                     <option>Рожден ден</option>                     <option>18+</option>                     <option>Други</option>                 </select></br>                 <input type="text" id="numpic" name="numpic" placeholder="номер на снимката" onfocus="this.placeholder = ''" onblur="this.placeholder = 'номер на снимката'"></br>                 <input type="submit" name="showfilter" value="покажи" />             </form> 

and php:

if (isset($_get["showfilter"]))              {                 $picname = $_get['nmpic'];                 $pricefrom = $_get['pricefrom'];                 $priceto = $_get['priceto'];                 $piccat = $_get['piccat'];                 $numpic = $_get['numpic'];                  $filter = " select * images status = '1'";                 if ($numpic && !empty($numpic)) {                     $filter .= " , id='$numpic'";                 }                 if ($picname && !empty($picname)) {                     $filter .= " , img_content='$picname'";                 }                 if ($piccat && !empty($piccat)) {                     $filter .= " , category='$piccat'";                 }                 if ($priceto && !empty($priceto)) {                     $filter .= " , price < '$priceto'+1";                 }                 $resfilter = $connect->query($filter);                  if ($resfilter->num_rows > 0)                  {                      while($row = mysqli_fetch_array($resfilter))                     {                          echo    "<div class='col-md-4 picture'>                                     <img class='child-img' src='".$row["picture"]." '/></br>                                         <div class='number'><span class='id'>№ ".$row['id']." | име: ".$row['img_content']." | категория: ".$row['category']." | цена: ".$row['price']."лв. | дата: ".$row['time']."ч.</span></div>                                  </div>";                      }                  } 

i can not understand wrong let me return error. , if choose category works without problem ...? line 313 is:

$piccat = $_get['piccat']; 

thank you.

your select box option need value tag be

<select name="piccat" id="piccat">                     <option value="" selected disabled>Изберете категория</option>                     <option value="Детски">Детски</option>                     <option value="Сватби">Сватби</option>                     <option value="Рожден ден">Рожден ден</option>                     <option value="18+">18+</option>                     <option value="Други">Други</option>                 </select> 

read html select tag

youe script open sql injection read how can prevent sql injection in php? prevent it


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -