query($sql); $navSections = array(); while ($row = mysql_fetch_array($result)) { $navSections[$row['id']]['id'] = $row['id']; $navSections[$row['id']]['name'] = $row['name']; } ////////////////////////////////////////////////////////////////////////////// // decide if we are in the event overview or event details // we have chosen boy or girl, now choosing size if (isset($_POST['stage1'])) { $template = "hoodies2.tpl"; $pageTitle = "Hoodies Signup - Stage 2"; $_SESSION['sex'] = $_POST['sex']; // we have chosen size, now choosing design } else if (isset($_POST['stage2'])) { $template = "hoodies3.tpl"; $pageTitle = "Hoodies Signup - Stage 3"; $_SESSION['size'] = $_POST['size']; // we have chosen design, now entering details } else if (isset($_POST['stage3'])) { $template = "hoodies4.tpl"; $pageTitle = "Hoodies Signup - Stage 4"; $_SESSION['design'] = $_POST['design']; // we have entered details, now confirming } else if (isset($_POST['stage4'])) { $template = "hoodies5.tpl"; $pageTitle = "Hoodies Signup - Stage 5"; $_SESSION['name'] = $_POST['name']; $_SESSION['mobile'] = $_POST['mobile']; $_SESSION['email'] = $_POST['email']; $_SESSION['address'] = $_POST['address']; // we have placed order, show confirmation! } else if (isset($_POST['complete'])) { $template = "hoodies6.tpl"; $pageTitle = "Hoodies Signup - Order Placed"; $sql = sprintf("INSERT INTO hoodies (name, mobile, email, address, sex, size, design) VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s')", makeSafe($_SESSION['name']), makeSafe($_SESSION['mobile']), makeSafe($_SESSION['email']), makeSafe($_SESSION['address']), makeSafe($_SESSION['sex']), makeSafe($_SESSION['size']), makeSafe($_SESSION['design']) ); $result = $mysql->query($sql); if ($result) { // order placed // send mail $mail = "Dear Hoodies person\n\n"; $mail .= "A very nice person has ordered a hoody, here is the info:\n"; $mail .= "Name: $_SESSION[name]\n"; $mail .= "Email: $_SESSION[email]\n"; $mail .= "Mobile: $_SESSION[mobile]\n"; $mail .= "Address: $_SESSION[address]\n"; $mail .= "Size: $_SESSION[size]\n"; $mail .= "Sex: $_SESSION[sex]\n"; $mail .= "Design: $_SESSION[design]\n\n"; $mail .= "Thanks,\n"; $mail .= "The EUCU Website.\n"; $headers = 'From: website@eucu.org.uk' . "\r\n" . 'Reply-To: website@eucu.org.uk' . "\r\n" . 'X-Mailer: Kahawa: PHP/' . phpversion(); mail("chris@ceejaycee.net", "EUCU: Hoody Order - $_SESSION[name]", $mail, $headers); //Lise's Email: , lisemmcdonnell@aol.com $content = '
Thank you. We have placed your order.
'; $content .= 'We will be in touch when your hoody is available.
'; } else { // order failed for some reason $content = 'We\'re really sorry, something broke when ordering your hoody. Please go back and try again. If this problem happens again, please contact us'; } // we are choosing boy or girl, we are at the beginning } else { $template = "hoodies1.tpl"; $pageTitle = "Hoodies Signup - Stage 1"; } // get all sub-sections of this section $sql = sprintf("SELECT * FROM sections WHERE parent = '%s'", makeSafe(28) ); $result = $mysql->query($sql); if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_array($result)) { $insideSections[$row['id']]['id'] = $row['id']; $insideSections[$row['id']]['name'] = $row['name']; } } // get all pages in this section $sql = sprintf("SELECT * FROM pages WHERE section = '%s' AND status = 'Publish'", makeSafe(28) ); $result = $mysql->query($sql); if (mysql_num_rows($result) > 0) { while ($row = mysql_fetch_array($result)) { $sectionPages[$row['id']]['id'] = $row['id']; $sectionPages[$row['id']]['title'] = $row['title']; } } //////////////////////////////////////////////////////////////////////////////// // Assign contents to variables for the template $smarty->assign('title', $pageTitle); // This is the page title, as displayed in the title bar $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->assign('content', $content); //////////////////////////////////////////////////////////////////////////////// $smarty->display($template); ?>