$result = $pdo->prepare('SELECT * FROM propertytable WHERE Property_ID = :id'); $result->bindValue(':id', $id); $result->execute(); foreach ($result as $location) { $email_owner = $location['member_email']; // get property owner email addr; } $result = $pdo->prepare('insert into inspection (vistor_email,owner_email) VALUES (:vistor_email,:owner_email)'); // add data into the inspection table; $result->bindValue(':vistor_email', $email_vistor); $result->bindValue(':owner_email', $email_owner); $result->execute(); $result = $pdo->prepare('SELECT * FROM inspection WHERE vistor_email = :vistor_email and owner_email = :owner_email'); $result->bindValue(':vistor_email', $email_vistor); $result->bindValue(':owner_email', $email_owner); $result->execute(); foreach ($result as $location) { $id_inspectionr = $location['id']; // get inspection id; } send_mail_lazypeople($email_owner, 'Inspection enquiry', "Someone wants to book an inspection of {$property_name}. If you want to accept this enquiry, please click this link:ifb299.sinaapp.com/IFB299/inspection_submit.php?id={$id_inspectionr}"); send_mail_lazypeople($email_vistor, 'Inspection sent', "You have sent an inspection email to a property owner."); include 'header.inc'; echo "<body>\n\t\t<div id='cssmenu'><ul><li><a href='Home.php'><span>Home</span></a></li>\n <li><a href='search.php'><span>Search</span></a></li>"; echo "<li><a href='Publish.php'>Publish</a></li>"; echo "<li><a href='myproperty.php'>My Property</a></li>"; echo "<li><a href='Logout.php'><span>Logout</span></a></li></ul></div>"; echo "<div class='form'><form><h1>The enquiry has been sent.</h1></form></div>"; } else { echo "Please login your account first."; }
$result_str .= $req[2] . $result . "\n"; } } } @fclose($fp); return $result_str; } include 'pdo.inc'; $id = $_GET['id']; $result = $pdo->prepare('UPDATE inspection SET status=1 where id= :id'); // mark inspection in the database; $result->bindValue(':id', $id); $result->execute(); $result = $pdo->prepare('select * from inspection where id= :id'); // add data into the inspection table; $result->bindValue(':id', $id); $result->execute(); foreach ($result as $item) { $vistor_email = $item['vistor_email']; // get inspection vistor email; $owner_email = $item['owner_email']; // get inspection owner email; } send_mail_lazypeople($vistor_email, 'The inspection comfirmation', "The inspection has been comfirmed and the owner email address is {$owner_email}."); send_mail_lazypeople($owner_email, 'The inspection comfirmation', "The inspection has been comfirmed and the vistor email address is {$vistor_email}."); include 'header.inc'; echo "<body>\n\t\t<div id='cssmenu'><ul><li><a href='Home.php'><span>Home</span></a></li>\n <li><a href='search.php'><span>Search</span></a></li>"; echo "<li><a href='Publish.php'>Publish</a></li>"; echo "<li><a href='myproperty.php'>My Property</a></li>"; echo "<li><a href='Logout.php'><span>Logout</span></a></li></ul></div>"; echo "<div class='form'><form><h1>The inspection has been comfirmed.</h1></form></div>";