StuartBombay
Programmer
I have this page, but when it runs on the form with the drop-down there is an error that states it can't fird $name on line 41, and on the results page is states it can't find the variable $display_block on line 50.
I'm sure this is a case of I missed keeping the HTML from the PHP somewhere. Can anyone see where I went wrong?
There are functions and headers that aren't shown in this code, despite that I hope my error jumps out at someone!
Thanks -
I'm sure this is a case of I missed keeping the HTML from the PHP somewhere. Can anyone see where I went wrong?
Code:
<?php
$page_title = 'PPS Site Summary - Employee Information';
include('header.html');
include('functions/form_functions.inc');
require('../../includes/configdb.inc');
require('../../includes/opendb.inc');
global $conn;
if (!$_POST) {
//if a selection has not been made, then show the selection form with dropdown
$display_block = "<h2>Who is...";
$display_block .= drop_down('person', 'username', 'full', 'v_people_detail', '', 'last');
$display_block .= "</h2>";
} else if ($_POST) {
//if a selection has been made, display info
if ($_POST["sel_id"] == "") {
header("Who is who_is.php");
exit;
} //end if
//get person info
$query = "SELECT * from v_people_detail where username =
'".$_POST["sel_id"]."'";
$get_person_rs = mysqli_query($conn, $query)
or die(mysqli_error($conn));
while ($person_info = mysqli_fetch_array($get_person_rs)) {
$name = stripslashes($person_info['full']);
$user = stripslashes($person_info['username']);
$emlpid = stripslashes($person_info['emplid']);
$progname = stripslashes($person_info['progname']);
$locname = stripslashes($person_info['locname']);
$phone = stripslashes($person_info['phone']);
$jobtitle = stripslashes($person_info['jobtitle']);
} //end while
$display_block .=" <li><h3>$name</h3> <a href='mailto:".$user."@pps.k12.or.us'> (Email ".$name.")</a>
<li>Department: $progname
<li>Located at: $locname
<li>Location phone: $phone
<li>Title: $jobtitle
</li></ul>";
$display_block .= "<br/><br/>";
$display_block .= "<br/><br/><br/>
<a href=\"".$_SERVER["PHP_SELF"]."\">Select another person</a></p>";
} //end if POST sel_id
//close connection to database
require('../../includes/closedb.inc')
?>
<html>
<head>
<?php echo $page_title = $name; ?>
</head>
<body>
<?php echo $display_block;
include('footer.html');?>
</body>
</html>
There are functions and headers that aren't shown in this code, despite that I hope my error jumps out at someone!
Thanks -