html - php error: Undefined index for search button -
this question has answer here:
i trying write code search button. problem errors:
- notice: undefined index: zoekbedrijf in php/vacatureoverzichtphp.php on line 12
- notice: undefined index: zoekdatum in php/vacatureoverzichtphp.php on line 13
i'm trying $_post variable can check if input filled or not , if not filled has show data database. new php , have never coded search before. can doing wrong.... thought work.
below can find php code:
<?php ini_set('display_errors',1); ini_set('display_startup_errors',1); error_reporting(-1); //include '../loginhandlerconnect.php'; include('php/loginhandlerconnect.php'); $db = loginhandlerconnect(); $bedrijfzoek = $db->quote($_post['zoekbedrijf']); //line 12 $datumzoek = $db->quote($_post['zoekdatum']); //line 13 if($bedrijfzoek == null && $datumzoek == null){ //code showing results } if($bedrijfzoek != null){ //code showing results } if($datumzoek != null){ //code showing results } if($bedrijfzoek != null && $datumzoek != null){ //code showing results } ?>
and html code:
<form class="form-inline pull-right" role="form" method="post" action="php/vacatureoverzichtphp.php"> <div class="form-group"> <label>zoeken op: </label> </div> <div class="form-group"> <label class="sr-only" for="zoekenbedrijf">bedrijfsnaam</label> <input type="text" class="form-control" name="zoekbedrijf" id="zoekenbedrijf" value="<?php echo (isset($_post['zoekbedrijf']) ? $_post['zoekbedrijf'] : ""); ?>" placeholder="bedrijfsnaam"> </div> <div class="form-group"> <label>of</label> </div> <div class="form-group"> <label class="sr-only" for="zoekendatum">datum</label> <input type="text" class="form-control" name="zoekdatum" id="zoekendatum" value="<?php echo (isset($_post['zoekdatum']) ? $_post['zoekdatum'] : ""); ?>" placeholder="datum"> </div> <button type="submit" class="btn btn-default">zoeken</button> </form> <br><br><br> <?php include("php/vacatureoverzichtphp.php"); ?>
can please me , tell me doing wrong or have different?
the error you're asking zoekbedrijf , zoekdatum field names zoekenbedrijf , zoekendatum.
Comments
Post a Comment