Warning: Invalid argument supplied for foreach()
Posted: Sun Jun 10, 2007 10:34 pm
I get an error of Warning: Invalid argument supplied for foreach() in /Library/WebServer/Documents/australianreit/contact/mail.php on line 138
Here is the full code you guys to see:
Any help would be great! 
Here is the full code you guys to see:
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Australian Real Estate Investment Limited</title>
<meta http-equiv="Content-Type" content="text/html; charset=macintosh" />
<LINK href="../common/areitstyle.css" rel="stylesheet" type="text/css">
</head>
<BODY>
<DIV id="wrapper_bg_left">
<DIV id="wrapper_bg_right">
<DIV id="wrapper_bg_left2">
<DIV id="wrapper_bg_right2">
<DIV id="wrapper_fullheight_left">
<DIV id="wrapper_fullheight_right">
<DIV id="wrapper_leftbg">
<DIV id="wrapper_leftbg2">
<DIV id="wrapper_rightbg">
<DIV id="wrapper_rightbg2">
<DIV id="header">
<DIV id="header_logo"></DIV>
</DIV>
<!-- NAVIGATION -->
<DIV id="nav_wrapper" class="menu">
<UL>
<!-- HOME -->
<LI>
<DIV class="home_line">
<a href="../index.html" title="Home" class="home">HOME</a>
</DIV>
</LI>
<!-- ABOUT US -->
<LI>
<DIV class="aboutus_line">
<a href="#" title="About Us" class="aboutus">ABOUT US</a>
</DIV>
<UL>
<LI><a href="../aboutus/overview.html">Overview</a></LI>
<LI>
<a class="drop" href="#" title="The Board">The Board</a>
<UL>
<LI><a href="../aboutus/sydney.html" title="Sydney Chesson">Sydney Chesson</a></LI>
<LI><a href="../aboutus/simon.html" title="Simon Chesson">Simon Chesson</a></LI>
<LI><a href="../aboutus/jeanette.html" title="Jeanette Chesson">Jeanette Chesson</a></LI>
</UL>
</LI>
<LI><a href="../aboutus/management.html">Management Team</a></LI>
</UL>
</LI>
</UL>
<!-- OPEN INVESTMENT -->
<UL class="noindent">
<LI>
<DIV class="openinvestment_line">
<a href="#" title="Open Investment" class="openinvestment">OPEN INVESTMENTS</a>
</DIV>
<UL>
<LI><a href="../openinvestments/diversified.html" title="AREIT Diversified Fund">AREIT Diversified Fund</a></LI>
<LI><a href="../openinvestments/development.html" title="AREIT Augusta Development Fund">AREIT Augusta Development Fund</a></LI>
<LI><a href="../openinvestments/mortgage.html" title="Agricultural Mortgage Trust">Agricultural Mortgage Fund</a></LI>
</UL>
</LI>
<!-- CLOSED INVESTMENT -->
<LI>
<DIV class="closedinvestment_line">
<a href="#" title="Closed Investments" class="closedinvestment">CLOSED INVESTMENTS</a>
</DIV>
<UL>
<LI><a href="../closedinvestments/kelmscott.html" title="Kelmscott Central Development Fund">Kelmscott Central Development Fund</a></LI>
</UL>
</LI>
<!-- INVESTOR SERVICES -->
<LI>
<DIV class="investors_line">
<a href="#" title="Investor Services" class="investors">INVESTOR SERVICES</a>
</DIV>
<UL>
<LI><a href="../investorservices/newsletters.html" title="Newsletters">Newsletters</a></LI>
<LI><a href="../investorservices/accounts.html" title="Financial Accounts">Financial Accounts</a></LI>
<LI><a href="../investorservices/forms.html" title="Forms">Forms</a></LI>
</UL>
</LI>
<!-- ADVISORS SERVICES -->
<LI>
<DIV class="advisors_line">
<a href="#" title="Advisor Services" class="investors">ADVISOR SERVICES</a>
</DIV>
<UL>
<LI><a href="../advisorservices/services.html" title="Advisor Services Team">Advisor Services Team</a></LI>
</UL>
</LI>
</UL>
<!-- NEWS -->
<UL class="noindent">
<LI>
<DIV class="news_line">
<a href="#" title="News" class="news">NEWS</a>
</DIV>
<UL>
<LI><a href="../news/2007.html" title="2007">2007</a></LI>
</UL>
</LI>
<!-- CONTACT US -->
<LI>
<DIV class="contact_line">
<a href="contact.html" title="Contact Us" class="contact">CONTACT US</a>
</DIV>
</LI>
</UL>
</DIV>
</DIV>
<!-- CONTENT AREA -->
<DIV id="center1">
<DIV id="content_center">
<?php
//Headers
$emailFromName = $_POST['name'];
$emailAddress = $_POST['address'];
$emailCity = $_POST['city'];
$emailState = $_POST['state'];
$emailPostcode = $_POST['postcode'];
$emailTelephone = $_POST['phone'];
$emailFrom = $_POST['email'];
$emailAdviser = $_POST['advisergroup'];
$emailContact = $_POST['contact'];
$emailAre = $_POST['are'];
$emailPds = $_POST['pds'];
$emailComment = $_POST['comment'];
$action = (isset($_POST['submit']) ? "submit" : "entry");
//Checkbox for Product Disclosure Statement
foreach($_POST['pds'] as $value) {
$check_msg .= "<br />- $value\n";
}
//Errors
$error_lines = array();
if ($action == "submit")
{
if (empty($emailFromName)) {
$error_lines['emailFromName'] = 'You forgot to enter your name.';
}
if (empty($emailAddress)) {
$error_lines['emailAddress'] = 'You forgot to enter your address.';
}
if (empty($emailCity)) {
$error_lines['emailCity'] = 'You forgot to enter your city.';
}
if (empty($emailState)) {
$error_lines['emailState'] = 'You forgot to enter your state.';
}
if (empty($emailPostcode)) {
$error_lines['emailPostcode'] = 'You forgot to enter your city.';
}
if (empty($emailTelephone)) {
$error_lines['emailTelephone'] = 'You forgot to enter your telephone.';
}
if (!preg_match('/^([A-Z0-9\.\-_]+)@([A-Z0-9\.\-_]+)?([\.]{1})([A-Z]{2,6})$/i', $emailFrom) || empty($emailFrom)) {
$error_lines['emailFrom'] = 'You forgot to enter a valid email address.';
}
}
if($action == "submit" && count($error_lines) == 0) {
//Send an email
$to = "paul.crawford@austasiagroup.com";
$Subject = "AREIT Enquiry Form";
$body = "The following enquiry was submitted via the AREIL website on ".date('l, d M Y H:i:s') . "\n\nName: ". $emailFromName ."\n\nAddress: ". $emailAddress ."\nCity: ". $emailCity ."\nState: ". $emailState ."\nPostcode: ". $emailPostcode ."\n\nTelephone: ". $emailTelephone ."\n\nEmail: ". $emailFrom ."\n\nAdviser Group: ". $emailAdviser ."\n\nPreferred method of contact: ". $emailContact ."\n\nAre you a: ". $emailAre ."\n\nPlease rush me Product Disclosure Statement for: ". $check_msg ."\n\nComments: ". $emailComment;
mail($to, "$Subject" ,"$body", "From: $emailFrom");
echo "
Thank you for enquiry, ". $emailFromName .". Your mail was sent successfully.
<p></p>
Your message is
<div class=\"quote\"><strong>Name</strong>
$emailFromName
<br />
<strong>Address</strong>
$emailAddress
<br />
<strong>City</strong>
$emailCity
<br />
<strong>State</strong>
$emailState
<br />
<strong>Postcode</strong>
$emailPostcode
<br />
<strong>Telephone</strong>
$emailTelephone
<br />
<strong>Email</strong>
$emailFrom
<br />
<br />
<strong>Adviser Group</strong>
$emailAdviser
<p></p>
<strong>Preferred method of contact</strong>
$emailContact
<p></p>
<strong>Are you a</strong>
$emailAre
<p></p>
<strong>Please rush me Product Disclosure Statement for</strong>
$check_msg
<p></p>
<strong>Comments</strong>
$emailComment</div>";
} else {
if (count($error_lines) > 0) {
echo "<div class=\"error\"><h1>Error!</h1>You have the following error(s):<br />\n\n";
foreach($error_lines as $line) {
echo "- $line<br />\n";
}
echo "<form method=\"post\" action=\"mail.php\">
</p>
Please complete the form and re-send it.</div>\n\n";
}
}
?>
</DIV>
</DIV>
<!-- FOOTER -->
<DIV id="footer3">
<DIV id="footer_border"></DIV>
</DIV>
</DIV>
</DIV></DIV>
</DIV>
</DIV></DIV>
<!-- footer -->
<DIV id="footer">
<DIV id="content_footer">
<a href="../aboutus/overview.html" id="nav_overview">About AREIT</a></LI>
<LI><a href="../links/links.html" id="nav_links">Links</a></LI>
<LI><a href="../faqs/faqs.html" id="nav_faqs">FAQ's</a></LI>
<LI><a href="../privacy/privacy.html" id="nav_privacy">Privacy Policy</a></LI>
<LI><a href="../disclaimer/disclaimer.html" id="nav_disclaimer">Disclaimer</a></LI>
<LI><a href="../../sitemap/sitemap.html" id="nav_sitemap">Sitemap</a></LI>
<LI><a href="contact.html" id="nav_contact">Contact Us</a></LI>
</DIV>
</DIV>
</DIV></DIV>
</DIV></DIV>
<script>
setActiveLink();
</script>
</BODY>
</HTML>