Jump to content

mailer array wrong


Codeman0013

Recommended Posts

hey i have a mailer page and it either displays array or skips the field occupation all togethor here is my code any one that can help me would be greatly appreciated...

<!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><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /><title>Illinois Soybean Association Membership Application</title><meta name="description" content="" /><meta name="keywords" content="" /><link href="../../_lib/global.css" rel="stylesheet" type="text/css" media="screen" /><link href="../../_lib/selectors.css" rel="stylesheet" type="text/css" media="screen" /><script language="JavaScript" type="text/javascript" src="../_lib/ilSoyJavascript.js"></script></head><body><!-- HEADER --><!--ZOOMSTOP--><?php require("../../_inc/header.php"); ?><!-- END OF HEADER --><div id="body">	<div id="left">		<div id="navContainer">			<ul id="nav">				<li><a href="/about/">ABOUT</a></li>				<li class="hi"><a href="/membership/">MEMBERSHIP</a></li>				<li>					<ul>						<li><a href="/membership/soy-connect/">SoyConnect</a></li>						<li class="select"><a href="/membership/application/">Membership Application</a></li>					</ul>				</li>				<li><a href="/soybean-uses/">SOYBEAN USES</a></li>				<li><a href="/education/">EDUCATION</a></li>				<li><a href="/soy-news/">SOY NEWS</a></li>				<li><a href="/resources/">RESOURCES</a></li>				<li><a href="/directors/">DIRECTORS</a></li>				<li><a href="/contact/">CONTACT</a></li>			</ul>		</div>		<div id="navBg"></div>	</div>	<div id="content">	   <div id="center">	     <p id="breadcrumbs"><a href="/">Home</a> » <a href="/membership/">Membership</a> » <a href="/membership/application/">Application</a> » <a href="/membership/application/verify.php" class="select">Confirm Application </a>	      <!--ZOOMRESTART-->		  <h2>Please Confirm Your Information:</h2><table>	<?phpforeach($_POST as $key){  $_POST[$key] = stripslashes(trim(str_replace("'","",$_POST[$key])));}print "<tr><td>Date: </td><td> $_POST[fielddate]</td></tr>";print "<tr><td>Name: </td><td> $_POST[fieldname]</td></tr>";print "<tr><td>Farm Name: </td><td> $_POST[fieldfarmname]</td></tr>";print "<tr><td>Spouse Name: </td><td> $_POST[fieldspousename]</td></tr>";print "<tr><td>Address: </td><td> $_POST[fieldaddress]</td></tr>";print "<tr><td>City: </td><td> $_POST[fieldcity]</td></tr>";print "<tr><td>State: </td><td> $_POST[fieldstate]</td></tr>";print "<tr><td>Zip: </td><td> $_POST[fieldzip]</td></tr>";print "<tr><td>County:</td><td>  $_POST[fieldcounty]</td></tr>";print "<tr><td>Phone: </td><td> $_POST[fieldphone]</td></tr>";print "<tr><td>Email:</td><td>  $_POST[fieldemail]</td></tr>";print "<tr><td>Age: </td><td> $_POST[Age]</td></tr>";print "<tr><td>Occupation: </td><td> ";for ($i=0;$i<count($_POST['fieldoccupation']);$i++) {  print $_POST['fieldoccupation'][$i] . "<br>\n";}  print "</td></tr>"; print "<tr><td>Do you want to receive the Illinois Soybean Review?:</td><td> $_POST[Review]</td></tr>";print "<tr><td>Acres farmed: </td><td> $_POST[fieldacres]</td></tr>";print "<tr><td>Soybean acres: </td><td> $_POST[fieldsoybeanacres]</td></tr>";print "<tr><td>Type of membership: </td><td> $_POST[Membership]</td></tr>";for ($i=0;$i<count($_POST['fieldoccupation']);$i++) {  print "<input type=\"hidden\" name=\"fieldoccupation[]\" value=\"".$_POST['fieldoccupation'][$i] . "\"/>\n";} foreach($_POST as $key){  print "<input type=\"hidden\" name=\"$key\" value=\"$_POST[$key]\" />";} ?></table><form action="/membership/application/mailapp.php" method="post"><input type="hidden" name="fielddate" value="<?php echo $_POST['fielddate']?>"><input type="hidden" name="fieldname" value="<?php echo $_POST['fieldname']?>"><input type="hidden" name="fieldfarmname" value="<?php echo $_POST['fieldfarmname']?>"><input type="hidden" name="fieldspousename" value="<?php echo $_POST['fieldspousename']?>"><input type="hidden" name="fieldaddress" value="<?php echo $_POST['fieldaddress']?>"><input type="hidden" name="fieldcity" value="<?php echo $_POST['fieldcity']?>"><input type="hidden" name="fieldstate" value="<?php echo $_POST['fieldstate']?>"><input type="hidden" name="fieldzip" value="<?php echo $_POST['fieldzip']?>"><input type="hidden" name="fieldcounty" value="<?php echo $_POST['fieldcounty']?>"><input type="hidden" name="fieldphone" value="<?php echo $_POST['fieldphone']?>"><input type="hidden" name="fieldemail" value="<?php echo $_POST['fieldemail']?>"><input type="hidden" name="Age" value="<?php echo $_POST['Age']?>"><input type="hidden" name"occupation" value="<?php echo $_POST['fieldoccupation[]']?>" ><input type="hidden" name="Review" value="<?php echo $_POST['Review']?>"><input type="hidden" name="fieldacres" value="<?php echo $_POST['fieldacres']?>"><input type="hidden" name="fieldsoybeanacres" value="<?php echo $_POST['fieldsoybeanacres']?>"><input type="hidden" name="Membership" value="<?php echo $_POST['Membership']?>"><input type="submit" name="submit" value="Send Email"><input type="button" value="Edit Info" onclick="history.back(-1)"></form>	  </div>	   	<div id="right">		<div class="blue">			<h2>Membership Dues</h2>			<p>$80 for one year<br />				$195 for three years			</p>		</div>		<!-- JOIN -->		<!--ZOOMSTOP-->		<?php require("../../_inc/join.php"); ?>		<!-- END JOIN -->	</div>	<br clear="both" /><!-- FOOTER -->	<?php require("../../_inc/footer.php"); ?> <!-- END OF FOOTER -->	</div></div></body></html>

and the mailer page

<!--ZOOMSTOP--><?php// Set things up here$date = $_POST['fielddate'];$name = $_POST['fieldname'];$farmname = $_POST['fieldfarmname'];$spousename = $_POST['fieldspousename'];$address = $_POST['fieldaddress'];$city = $_POST['fieldcity'];$state = $_POST['fieldstate'];$zip = $_POST['fieldzip'];$county = $_POST['fieldcounty'];$phone = $_POST['fieldphone'];$email = $_POST['fieldemail'];$age = $_POST['Age'];$occupation = explode ("|", $_POST['fieldoccupation']);$review = $_POST['Review'];$acres = $_POST['fieldacres'];$soybeans = $_POST['fieldsoybeanacres'];$membership = $_POST['Membership'];$to      = 'isintern@jonesthomas.com';$headers = 'From: ilsoy'.    $subject = 'Illinois Soybean Association Membership Application';// Start the message$message = "Hello the following person has requested to join the Illinois Soybean Association\nDate: $date\nName: $name\nFarm Name: $farmname\nSpouse Name: $spousename\nAddress: $address\nCity: $city\nState: $state\nZip: $zip\nCounty: $county\nPhone: $phone\nEmail: $email\nAge: $age\nOccupation: $occupation\nDo you want to receive the Illinois Soybean Review?: $review\nAcres farmed: $acres\nSoybean acres: $soybeans\nPlease choose your membership: $membership\n";print_r($_POST);exit();  // Finally send it off.//if(mail($to, $subject, $message, $headers))//{ // header("Location: /membership/application/thankyou.php");//}//else//{ // header("Location: /membership/application/");//}?> 

please help me i'm stuckk...

Link to comment
Share on other sites

Wow, there's something called the "Illinois Soybean Review"? Sounds like fun!Look at this line:<input type="hidden" name"occupation" value="<?php echo $_POST['fieldoccupation[]']?>" >There are a few problems. First, there's no equal sign between name and "occupation". And the name should be "fieldoccupation" instead of just "occupation". Also, the echo statement is not going to do what you expect, it probably won't print anything at all. You had the right idea higher up, it's probably better to replace that line with this:

<?phpfor ($i=0;$i<count($_POST['fieldoccupation']);$i++) {print "<input type=\"hidden\" name=\"fieldoccupation[]\" value=\"".$_POST['fieldoccupation'][$i] . "\"/>\n";}?>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...