Good day! I am currently working on this code. My problem is that the delete option don't function. It gets the error "There has been a fatal error." as stated in the code, so please help me to fix this code. Thank you
<html>
<head>
<title>Buyer's Profile</title>
</head>
<body>
<?php
if (isset($_GET['delete'])){
$id = $_GET['delete'];
mysql_connect("localhost", "root", "root") or die("Could not connect to the server");
mysql_select_db("purchase") or die ("That database could not be found");
$userquery = mysql_query("SELECT * FROM property, personal, spouse WHERE id='$dbid'") or die ("The query could not be completed.");
$userquery = mysql_query("DELETE FROM property, personal, spouse WHERE id='$dbid'") or die ("The query could not be completed.");
}
if (isset($_GET['id'])){
$id = $_GET['id'];
mysql_connect("localhost", "root", "root") or die("Could not connect to the server");
mysql_select_db("purchase") or die ("That database could not be found");
$userquery = mysql_query("SELECT * FROM property JOIN personal ON property.id=personal.id JOIN spouse ON property.id=spouse.id") or die ("The query could not be completed.");
if (mysql_num_rows($userquery) != 1){
die("That id could not be found!");
}
while($row = mysql_fetch_array($userquery, MYSQL_ASSOC)){
$dbid = $row['id'];
$typepay = $row['typepay'];
$phase = $row['phase'];
$section = $row['section'];
$block = $row['block'];
$lot = $row['lot'];
$housemodel = $row['housemodel'];
$reservefee = $row['reservefee'];
$grosstotal = $row['grosstotal'];
$nettotal = $row['nettotal'];
$sourcesale = $row['sourcesale'];
$buyertype = $row['buyertype'];
$famname = $row['famname'];
$firname = $row['firname'];
$midname = $row['midname'];
$contnum = $row['contnum'];
$email = $row['email'];
$address = $row['address'];
$sex = $row['sex'];
$age = $row['age'];
$month = $row['month'];
$day = $row['day'];
$year = $row['year'];
$civstat = $row['civstat'];
$citizenship = $row['citizenship'];
$occupation = $row['occupation'];
$position = $row['position'];
$yearswork = $row['yearswork'];
$typeemp = $row['typeemp'];
$empstat = $row['empstat'];
$presentemp = $row['presentemp'];
$employer = $row['employer'];
$income = $row['income'];
$tin = $row['tin'];
$hdmf = $row['hdmf'];
$project = $row['project'];
$spfamname = $row['spfamname'];
$spfirname = $row['spfirname'];
$spmidname = $row['spmidname'];
$spemail = $row['spemail'];
$spaddress = $row['spaddress'];
$spsex = $row['spsex'];
$spage = $row['spage'];
$spmonth = $row['spmonth'];
$spday = $row['spday'];
$spyear = $row['spyear'];
$spcivstat = $row['spcivstat'];
$spcitizenship = $row['spcitizenship'];
$spoccupation = $row['spoccupation'];
$spposition = $row['spposition'];
$spyearswork = $row['spyearswork'];
$sptypeemp = $row['sptypeemp'];
$spempstat = $row['spempstat'];
$sppresentemp = $row['sppresentemp'];
$spemployer = $row['spemployer'];
$spincome = $row['spincome'];
$sptin = $row['sptin'];
$sphdmf = $row['sphdmf'];
$spproject = $row['spproject'];
}
if($id != $dbid) {
die ("There has been a fatal error.");
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Application List</title>
<meta charset="utf-8" />
<link rel="stylesheet" href="search.css" type="text/css" />
<script src="agentvalidate.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body class="body">
<header class="mainHeader">
<img src="img/about.jpg">
<nav><ul>
<li><a href="home.html">Home</a></li>
<li><a href="about-us.html">About Us</a></li>
<li><a href="project.html">Project</a>
<ul>
<li><a href="purchase-app-property-info.html" class="purchase">Purchase</a></li>
<li><a href="house-and-lot.html" class="house&lot">House & Lot</a></li>
</ul>
</li>
<li><a href="contact-us.html">Contact Us</a></li>
</ul></nav>
</header>
<div class="mainContent">
<div class="content">
<article class="topcontent">
<header>
<h2><?php echo $firname; ?><?php echo " "; ?><?php echo $famname; ?>'s Profile</h2>
</header>
<content>
<hr>
<h2>Property Information</h2><br>
<table>
<tr><td>ID No.:</td><td><?php echo $dbid; ?></td></tr>
<tr><td>Type of Payment:</td><td><?php echo $typeemp; ?></td></tr>
<tr><td>Project:</td><td><?php echo $project; ?></td></tr>
<tr><td>Phase/Building:</td><td><?php echo $phase; ?></td></tr>
<tr><td>Section/Floor/Tower:</td><td><?php echo $section; ?></td></tr>
<tr><td>Block:</td><td><?php echo $block; ?></td></tr>
<tr><td>Lot/Lot Area:</td><td><?php echo $lot; ?></td></tr>
<tr><td>House Model/House Model Category:</td><td><?php echo $housemodel; ?></td></tr>
<tr><td>Reservation Fee:</td><td><?php echo $reservefee; ?></td></tr>
<tr><td>Gross Total List Price:</td><td><?php echo $grosstotal; ?></td></tr>
<tr><td>Net Total Contract Price:</td><td><?php echo $nettotal; ?></td></tr>
<tr><td>Source of Sale:</td><td><?php echo $sourcesale; ?></td></tr>
</tr>
</table>
</content>
</article>
<article class="topcontent">
<header>
<h2 class="info">Personal Information</a></h2><br>
</header>
<table>
<tr><td>Name:</td><td><?php echo $famname; ?><?php echo ", "; ?><?php echo $firname; ?><?php echo " "; ?><?php echo $midname; ?><?php echo "."; ?></td></tr>
<tr><td>Contact No.:</td><td><?php echo $contnum; ?></td></tr>
<tr><td>Home Address:</td><td><?php echo $address; ?></td></tr>
<tr><td>Sex:</td><td><?php echo $sex; ?></td></tr>
<tr><td>Age:</td><td><?php echo $age; ?></td></tr>
<tr><td>Birthdate:</td><td><?php echo $month; ?><?php echo ". "; ?><?php echo $day; ?><?php echo ", "; ?><?php echo $year; ?></td></tr>
<tr><td>Civil Status:</td><td><?php echo $civstat; ?></td></tr>
<tr><td>Citizenship:</td><td><?php echo $citizenship; ?></td></tr>
<tr><td>Occupation:</td><td><?php echo $occupation; ?></td></tr>
<tr><td>Position:</td><td><?php echo $position; ?></td></tr>
<tr><td>Years in Current Work/Business:</td><td><?php echo $yearswork; ?></td></tr>
<tr><td>Employment Type:</td><td><?php echo $typeemp; ?></td></tr>
<tr><td>Employment Status:</td><td><?php echo $empstat; ?></td></tr>
<tr><td>Present Employer:</td><td><?php echo $presentemp; ?></td></tr>
<tr><td>Employer:</td><td><?php echo $employer; ?></td></tr>
<tr><td>Gross Monthly Income:</td><td><?php echo $income; ?></td></tr>
<tr><td>TIN:</td><td><?php echo $tin; ?></td></tr>
<tr><td>HDMF/SSS/GSIS No:</td><td><?php echo $hdmf; ?></td></tr>
</table>
</content>
</article>
<article class="topcontent">
<header>
<h2 class="info">Spouse's Personal Information</a></h2><br>
</header>
<table>
<tr><td>Name:</td><td><?php echo $spfamname; ?><?php echo ", "; ?><?php echo $spfirname; ?><?php echo " "; ?><?php echo $spmidname; ?><?php echo "."; ?></td></tr>
<tr><td>Email:</td><td><?php echo $spemail; ?></td></tr>
<tr><td>Home Address:</td><td><?php echo $spaddress; ?></td></tr>
<tr><td>Sex:</td><td><?php echo $spsex; ?></td></tr>
<tr><td>Age:</td><td><?php echo $spage; ?></td></tr>
<tr><td>Birthdate:</td><td><?php echo $spmonth; ?><?php echo ". "; ?><?php echo $spday; ?><?php echo ", "; ?><?php echo $spyear; ?></td></tr>
<tr><td>Civil Status:</td><td><?php echo $spcivstat; ?></td></tr>
<tr><td>Citizenship:</td><td><?php echo $spcitizenship; ?></td></tr>
<tr><td>Occupation:</td><td><?php echo $spoccupation; ?></td></tr>
<tr><td>Position:</td><td><?php echo $spposition; ?></td></tr>
<tr><td>Years in Current Work/Business:</td><td><?php echo $spyearswork; ?></td></tr>
<tr><td>Employment Type:</td><td><?php echo $sptypeemp; ?></td></tr>
<tr><td>Employment Status:</td><td><?php echo $spempstat; ?></td></tr>
<tr><td>Present Employer:</td><td><?php echo $sppresentemp; ?></td></tr>
<tr><td>Employer:</td><td><?php echo $spemployer; ?></td></tr>
<tr><td>Gross Monthly Income:</td><td><?php echo $spincome; ?></td></tr>
<tr><td>TIN:</td><td><?php echo $sptin; ?></td></tr>
<tr><td>HDMF/SSS/GSIS No:</td><td><?php echo $sphdmf; ?></td></tr>
</table>
</content>
</article>
</div>
<aside class="top-sidebar">
<article>
<img src="img/applications.png"><a href="mainapp.php">Application List</a></li><hr>
<img src="img/agent.png"><a href="mainagent.php">Agent's Profile</a></li><hr><br>
<img src="img/add.png"><a href="addagent.html">Add Agent</a></li><hr><br>
<img src="img/accounts.png"><a href="home.html">Manage Accounts</a></li><hr><br>
<img src="img/logout.png"><a href="home.html">Log Out</a></li><hr>
</article>
</aside>
<aside class="middle-sidebar">
<article>
<h4>Search the list:</h4><hr>
<form action="searchapp.php" method="GET">
<table>
<tr><td>ID No.<input size="6" type="text" id="id" name="id"></td></tr>
<tr><td><input type="submit" id="submit" name="submit" value="View Profile!"></td></tr>
<tr><td><input type="submit" id="submit" name="submit" value="delete"></td></tr>
</table>
</form>
</article>
</aside>
</div>
<footer class="mainFooter">
<p>Copyright © Team Necktie 2014<br> A member of <a href="http://filinvest.com">Filinvest Corporation</a>. Visit us also in our <a href="http://facebook.com">Facebook</a> page.</p>
</footer>
<?php
} else die ("You need to specify an id!");
?>
</body>
</html>