Home PHP search is not working in multiple database tables
 This question already has an answer here: PHP: “Notice: Undefined variable”, “Notice: Undefined index”, and “Notice: Undefined offset” 24 answers I'm trying to do a search form where you can search in multiple database tables, and its working when i search in only one table but when i try with two tables im getting a "Undefined index" error. This is the html code : 
 And this is the php code above html tag. The code for searching is in the second php tag:  query($query) or die ($mysqli->error.__LINE__); ?> error.__LINE__); $count = mysqli_num_rows($query); if($count == 0){$searchoutput = 'There was no search results!'; }else{ while($row = mysqli_fetch_array($query)){ $first_name=$row['first_name']; $last_name=$row['last_name']; $email=$row['email']; $address=$row['address']; $address2=$row['address2']; $city=$row['city']; $state=$row['state']; $searchoutput.=' '.$row['first_name'].' '.$row['last_name'].''.$row['email'].''.$row['address'].' '.$row['city'].' '.$row['state'].'Edit ';$searchoutput.=''; $searchoutput.='';$searchoutput.=''; $searchoutput.='';$searchoutput.=''; } } } ?>