query($sql); if ($result) { $msg = "Thanks. You have been signed up. We'll be in touch soon!"; $mail = "Dear Adopt a Fresher person\n\n"; $mail .= "A very nice fresher has just asked to be adopted, here is the info:\n"; $mail .= "Name: $_POST[name]\n"; $mail .= "Email: $_POST[email]\n"; $mail .= "Mobile: $_POST[mobile]\n"; $mail .= "Address: $_POST[address]\n"; $mail .= "Course: $_POST[course]\n"; $mail .= "Age: $_POST[age]\n\n"; $mail .= "Thanks,\n"; $mail .= "The EUCU Website.\n"; $headers = 'From: chris@ceejaycee.net' . "\r\n" . 'Reply-To: chris@ceejaycee.net' . "\r\n" . 'X-Mailer: Kahawa: PHP/' . phpversion(); mail("chris@ceejaycee.net, im.short.5.1@gmail.com", "EUCU: Adopt a Fresher Signup - $_POST[name]", $mail, $headers); } else { $msg = "Sorry, something broke. Please try again later or email us directly."; } //////////////////////////////////////////////////////////////////////////////// // define some variables, so that if they are not using we don't get errors $insideSections = array(); $sectionPages = array(); //////////////////////////////////////////////////////////////////////////////// // get the nav bar links $sql = "SELECT * FROM sections WHERE parent = 'ROOT'"; $result = $mysql->query($sql); $navSections = array(); while ($row = mysql_fetch_array($result)) { $navSections[$row['id']]['id'] = $row['id']; $navSections[$row['id']]['name'] = $row['name']; } //////////////////////////////////////////////////////////////////////////////// // Assign contents to variables for the template $smarty->assign('title', "Adopt A Fresher"); // This is the page title, as displayed in the title bar $smarty->assign('content', $msg); // This is the page content! $smarty->assign('navSections', $navSections); // This is the links for the navigation bar $smarty->assign('insideSections', $insideSections); // This is for the sub-sections of this section $smarty->assign('sectionPages', $sectionPages); // This is for all the pages which belong to this category //////////////////////////////////////////////////////////////////////////////// $smarty->display('page.tpl'); } else { // can't find any info header("Location: index.php"); echo "no"; } ?>