PHP Form Not Working

Hello,

We now have only one e-mail PHP based form on our site that is not currently working. It contains two forms and we also will post the e-mail script that is working for every other page on our site.

I have attached the entire form below.

Thanks in advance for any help that can be provided.

Best,

Justin
<?php
include 'config.php';
include 'opendb.php';
$groupstop  = "SELECT id, groupname, status FROM groups WHERE status = 1 ORDER BY groupname ASC";
$resulttop = mysql_query($groupstop);
$groups  = "SELECT id, groupname, status FROM groups WHERE status = 1 ORDER BY groupname ASC";
$result1 = mysql_query($groups);
$industries  = "SELECT id, name, short, status FROM industries WHERE status = 1";
$result2 = mysql_query($industries);
$locations  = "SELECT id, city, state, status FROM locations WHERE status = 1";
$result3 = mysql_query($locations);
$industries1  = "SELECT id, name, short FROM industries WHERE status = 1";
$result4 = mysql_query($industries1);
$groupsside  = "SELECT id, groupname, status FROM groups WHERE status = 1 ORDER BY groupname ASC";
$result5 = mysql_query($groupsside);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>The Abacus Group &#150; Submit A Position</title>
<!-- <script src="rollovers.js" type="text/javascript"></script> -->
<link rel="stylesheet" href="main.css" type="text/css">
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css">
<script src="SpryAssets/SpryValidationCheckbox.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationCheckbox.css" rel="stylesheet" type="text/css" />
<script src="SpryAssets/SpryValidationSelect.js" type="text/javascript"></script> 
<link href="SpryAssets/SpryValidationSelect.css" rel="stylesheet" type="text/css" />
</head>
<body>
 
<!-- START of DIV wrapper to center the whole page -->
 
	<div id="wrapper">  
 
	<!-- START of MainTable, this table holds the drop shadows for the outside of the page -->
 
	<table id="maintable">
	<tr>
		<td class="top" colspan="3"><img src="images/shadow_top.jpg" width="811" height="5" alt=""></td>
	</tr>
	<tr>
		<td class="sideleft"><img src="images/spacer.gif" width="5" height="1" alt=""></td>
		<td class="content">
	<!-- \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -->
	<!-- START of HEADER TABLE -->
	<!-- \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -->
	<table id="headertable">
	<tr>
		<td class="left"><img src="images/logo.jpg" width="580" height="66" alt="Abacus Group Logo"></td>
		<td class="right"><form action="positions.php" method="POST" name="form1"><img src="images/spacer.gif" width="1" height="20" alt=""><br />SEARCH JOBS<br /><img src="images/spacer.gif" width="1" height="3" alt=""><br />
						<select name="top_position_group" class="topsearch">
						<option value="" selected>Select a position group</option>";
					<?php
					while($row = mysql_fetch_array($resulttop))	{
						echo"<option value=\"$row[id]\">$row[groupname]</option>";
						}  ?>
						</select><input type=image align=middle SRC="images/go.gif"><br />&nbsp;<br />
						<a href="submit_position.php" class="topright">SUBMIT POSITION</a>&nbsp;&nbsp;<a href="submit_resume.php" class="topright">SUBMIT RESUME</a></form></td>
	</tr>
	</table>
	<table id="navtable">
	<tr>
		<td class="top"><img src="images/spacer.gif" width="1" height="1" alt=""></td>
	</tr>
	<tr>
		<td class="mid"><a href="index.php"><img src="images/nav/nav_01.jpg" width="93" height="33" border="0" alt="Home"></a><a href="about.php"><img src="images/nav/nav_02.jpg" width="114" height="33" border="0" alt="About Us"></a><a href="employers.php"><img src="images/nav/nav_03.jpg" width="124" height="33" border="0" alt="Employers"></a><a href="candidates.php"><img src="images/nav/nav_04.jpg" width="131" height="33" border="0" alt="candidates"></a><a href="positions.php"><img src="images/nav/nav_05.jpg" width="195" height="33" border="0" alt="Current Positions"></a><a href="contact.php"><img src="images/nav/nav_06.jpg" width="144" height="33" border="0" alt="Contact Us"></a></td>
	</tr>
	<tr>
		<td class="bottom"><img src="images/spacer.gif" width="1" height="3" alt=""></td>
	</tr>
	</table>
	<table id="bannertable">
	<tr>
		<td class="top"><img src="images/submit/submit_pic.jpg" width="801" height="90" alt="Submit Pic"></td>
	</tr>
	<tr>
		<td class="mid"><img src="images/submit/submit_title.jpg" width="801" height="34" alt="Submit Title"></td>
	</tr>
	<tr>	
		<td class="bottom" height="107" style="background: url(images/submit/submit_desc_bg.jpg);"><p>Contact the Abacus Group to learn more about  our<br>
		  custom staffing solutions.</p></td>
	</tr>
	</table>
	<!-- START of the main CONTENT TABLE, this table holds the smaller tables that make up the main content window -->
	<table id="contenttable">
	<tr>
		<!-- START the LEFT content the td holds all the stuff in the left column -->
		<td class="left">
			<div> <!--  DIV tag For IE to center the TD Cell --->
			<!-- This table is a smaller table used to hold the boxed info for this column in here are the drop shaddows for this box -->
			<table id="smalllefttable">
			<tr>
				<td class="top" colspan="3"><img src="images/employers/talk_to_sm.jpg" width="211" height="27" alt="Talk To A Representative"></td>
			</tr>
			<tr>
				<td class="leftshadow"></td>
				<td class="content">
					<!-- This is the content inside of the shadowed smaller box -->
					<form action="confirmationt.php" method="POST" class="employers">
					Fill out the form to have a representative from the Abacus Group contact you to discuss your staffing needs.<br />
					&nbsp;<br />
					Tell us about your company.<br />
					Contact Name <span id="sprytextfield1">
					<input type="text" name="name" maxlength="50" value="" style="width: 95px;" class="employers">
					<span class="textfieldRequiredMsg">Contact Name is required.</span></span><br />
					Company <span id="sprytextfield2"><input type="text" name="company" maxlength="50" value="" style="width: 121px;" class="employers">
					<span class="textfieldRequiredMsg">Company is required.</span></span><br />
					Phone <span id="sprytextfield3"><input type="text" name="phone" maxlength="50" value="" style="width: 142px;" class="employers">
					<span class="textfieldRequiredMsg">Phone Number is required.</span></span>
					Email <span id="sprytextfield4"><input type="text" name="email" maxlength="50" value="" style="width: 142px; margin-bottom:10px;" class="employers">
                    <span class="textfieldRequiredMsg">Email is required.</span><span class="textfieldInvalidFormatMsg">Invalid Email format.</span></span><br />
					What position do you need filled&#63;<br />
					<span id="ValidCheckbox1">
					<input type="checkbox" name="permanent" value="permanent"> Permanent<input type="checkbox" name="temporary" value="temporary"> Temporary
					<span class="checkboxRequiredMsg">Please check at least 1.</span></span><br />
						
						<img src="images/spacer.gif" width="1" height="10" alt=""><br />
						<span id="spryselect1" class="selectRequiredValue"><select name="position_group" style="width:175px;" class="employers">
						<option value="-1" selected>Select a position group</option>
						<option value="not listed" >Position Not Listed</option>
									<?php
									while($row = mysql_fetch_array($result1))	{
									echo"<option value=\"$row[groupname]\">$row[groupname]</option>";
									}  ?>
						</select><br><span class="selectInvalidMsg">Please select a Group.</span></span><br />
						<img src="images/spacer.gif" width="1" height="15" alt=""><input type="hidden" name="submit" value="1"><br />
						<p class="submitleft">
						<input type="image" src="images/employers/submit.jpg" class="submit">
						</p>
					</form>
					<!-- End of this smallbox content -->				</td>
				<td class="rightshadow"></td>
			</tr>
			<tr>
				<td class="bottomshadow" colspan="3"><img src="images/leftbox_bottomshadow.gif" width="211" height="8" alt=""></td>
			</tr>
			</table>
			<!-- End of this smallbox -->		
		</div>
		</td>
		<!-- START of the content that goes on the RIGHT side of the main content window -->
		<td class="right">
		<div> <!--  DIV tag For IE to center the TD Cell --->
			<table id="submitpositionbox">
			<tr>
				<td class="top" colspan="3"><img src="images/submit/submit_a.jpg" width="342" height="27" alt="Submit A Position"></td>
			</tr>
			<tr>
				<td class="leftshadow"></td>
				<td class="content" >
					<form action="confirmationt.php" method="POST" enctype="multipart/form-data" class="position">
					Fill out the form below to submit a position you are looking to fill.<br />
					&nbsp;<br />
					Tell us about your company.<br />
					Contact Name <span id="sprytextfield5">
					<input type="text" name="contactname" maxlength="50" value="" style="width: 180px;" class="position">
					<span class="textfieldRequiredMsg">Contact Name is required.</span></span><br />
					Company <span id="sprytextfield6">
					<input type="text" name="companyname" maxlength="50" value="" style="width: 174px;" class="position">
					<span class="textfieldRequiredMsg">Company is required.</span></span><br />
					Phone <span id="sprytextfield7"><input type="text" name="phone1" maxlength="50" value="" style="width: 227px;" class="position">
					<span class="textfieldRequiredMsg">Phone Number is required.</span></span><br />
					Email&nbsp;<span id="sprytextfield8">
                    <input name="email1" type="text" class="position" id="email1" style="width: 227px; margin-bottom:10px;" value="" maxlength="50">
                    <span class="textfieldRequiredMsg">Email is required.</span><span class="textfieldInvalidFormatMsg">Invalid Email format.</span></span><br />
					<img src="images/spacer.gif" width="1" height="10" alt=""><br />
					Tell us about the position.<br />
					<img src="images/spacer.gif" width="1" height="2" alt=""><br />
					<span id="ValidCheckbox2">
					<input type="checkbox" name="permanent" value="permanent"> Permanent&nbsp;&nbsp;&nbsp;<input type="checkbox" name="temporary" value="temporary"> Temporary<br>
					<span class="checkboxRequiredMsg">Please check at least 1.</span></span><br />
					<img src="images/spacer.gif" width="1" height="5" alt=""><br />
					<span id="spryselect2" class="selectRequiredValue"><select name="industry" style="width:245px;" class="position">
						<option value="-1" selected >Select an position group</option>
						<option value="not listed" >Position Not Listed</option>
									<?php
									while($row = mysql_fetch_array($result5))	{
									echo"<option value=\"$row[groupname]\">$row[groupname]</option>";
									}  ?>
						</select><span class="selectInvalidMsg"><br>Please select a Group.</span></span><br /><img src="images/spacer.gif" width="1" height="10" alt=""><br />
					Position Title <span id="sprytextfield9"><input type="text" name="position_title" maxlength="50" value="" style="width: 190px;" class="position">
					<span class="textfieldRequiredMsg">Position Title is required.</span></span><br />
					Salary Range <span id="sprytextfield10"><input type="text" name="salary_range" maxlength="50" value="" style="width: 185px;" class="position">
					<span class="textfieldRequiredMsg">Salary Range is required.</span></span><br />
					<img src="images/spacer.gif" width="1" height="2" alt=""><br />
					Upload job description in a text file, OR copy<br />and paste it into the text box below.<br /><input type="file" name="file1" id="file1" value="" style="width: 265px;" class="position" /><br />
					<img src="images/spacer.gif" width="1" height="10" alt=""><br />
					Describe the position.
						<textarea name="describe_position" style="width:270px; height:100px;" class="position"></textarea>
						<img src="images/spacer.gif" width="1" height="10" alt=""><input type="hidden" name="submitposition" value="1"><br />
						<p class="submitright">
						<input type=image src="images/contact/submit.jpg" border="0" >
						</p>
					</form>
				</td>
				<td class="rightshadow"></td>
			</tr>
			<tr>
				<td class="bottomshadow" colspan="3"><img src="images/leftbox_bottomshadow.gif" width="342" height="8" alt=""></td>
			</tr>
			</table>
			</div>
		</td>
		<!-- End of the LEFT side content -->
	</tr>	
	</table>
	<!-- End of the CONTENT TABLE -->
	<br />
	<!-- \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -->
	<!-- START of FOOTER TABLE -->
	<!-- \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -->
	<table id="footertable">
	<tr>
		<td class="top" colspan="2"><img src="images/count_on_us.jpg" width="79" height="13" alt="count on us"></td>
	</tr>
	<tr>
		<td class="mid" colspan="2"><hr></td>
	</tr>
	<tr>	
		<td class="bottomleft"><img src="images/spacer.gif" width="1" height="1" alt=""><br /><a href="privacy.html" class="footer">privacy policy</a><img src="images/dots.gif" width="23" height="18" alt="dots" align="middle"><a href="sitemap.html" class="footer">site map</a></td>
		<td class="bottomright"><p>14 penn plaza, suite 1600, new york, new york 10122<br />
		<b><i>telephone</i></b> 212.812.8444 &#149; <b><i>fax</i></b> 212.812.8448 &#149; <a href="mailto:info@abacusnyc.com" class="email">info@abacusnyc.com</a></p></td>
	</tr>
	</table>
	<!-- \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -->
	<!-- END of CONTENT TABLE -->
	<!-- \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -->
 
	<br />
	</td>
	<td class="sideright"></td>
	</tr>
	<tr>
		<td class="top" colspan="3"><img src="images/shadow_bottom.jpg" width="811" height="5" alt=""></td>
	</tr>
	</table>
	<!-- END of MAIN TABLE -->
	</div>
	<!-- END of DIV for wrapper -->	
 
 
    <script type="text/javascript">
<!--
 
var ValidCheckbox1 = new Spry.Widget.ValidationCheckbox("ValidCheckbox1", {minSelections:1});
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2");
var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "phone_number");
var phone = new Spry.Widget.ValidationTextField("phone", "phone_number", {validateOn:["submit"], useCharacterMasking:true});
var sprytextfield4 = new Spry.Widget.ValidationTextField("sprytextfield4", "email");
var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1", {invalidValue:"-1"});
 
var ValidCheckbox2 = new Spry.Widget.ValidationCheckbox("ValidCheckbox2", {minSelections:1});
var sprytextfield5 = new Spry.Widget.ValidationTextField("sprytextfield5");
var sprytextfield6 = new Spry.Widget.ValidationTextField("sprytextfield6");
var sprytextfield7 = new Spry.Widget.ValidationTextField("sprytextfield7", "phone_number");
var phone1 = new Spry.Widget.ValidationTextField("phone1", "phone_number", {validateOn:["submit"], useCharacterMasking:true});
var sprytextfield8 = new Spry.Widget.ValidationTextField("sprytextfield8", "email");
var spryselect2 = new Spry.Widget.ValidationSelect("spryselect2", {invalidValue:"-1"});
var sprytextfield9 = new Spry.Widget.ValidationTextField("sprytextfield9");
var sprytextfield10 = new Spry.Widget.ValidationTextField("sprytextfield10");
var sprytextfield11 = new Spry.Widget.ValidationTextField("sprytextfield11");
 
//-->
</script>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-5821975-1");
pageTracker._trackPageview();
</script></BODY>
</HTML>
<?php
include 'closedb.php';
?>

Open in new window

jsuissaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

jsuissaAuthor Commented:
Below I also posted out actual e-mail script to help diagnose the issue.
<?php
 
session_start();
 
$position = $_SESSION['position_group'];
$search_url = $_SESSION["PositionsSearchURL"];
 
if ($position == "") {
	$position == "none";
}
 
include 'config.php';
include 'opendb.php';
$groupstop  = "SELECT id, groupname, status FROM groups WHERE status = 1 ORDER BY groupname ASC";
$resulttop = mysql_query($groupstop);
$groups  = "SELECT id, groupname, email, status FROM groups WHERE groupname = '$position' AND status = 1";
$result1 = mysql_query($groups);
$industries  = "SELECT id, name, short, status FROM industries WHERE status = 1";
$result2 = mysql_query($industries);
$locations  = "SELECT id, city, state, status FROM locations WHERE status = 1";
$result3 = mysql_query($locations);
 
$rowgroup = mysql_fetch_array($result1);
 
$emailsend = "abacusweb@abacusnyc.com";  //This email will be abacusweb@abacusnyc.com
 
if(mysql_num_rows($result1) == 1) {
	$emailsend = $rowgroup["email"];
}
 
if (isset($_REQUEST['employers'])){
	$pagename = "Page: Employer Page" . "\r\n";
	$subject="Request To Talk To A Representative";
}
 
if (isset($_REQUEST['contact'])){
	$pagename = "Page: Contact Us Page" . "\r\n";
	$subject="Request To Talk To A Representative";
}
 
if (isset($_REQUEST['submit'])){
	$pagename = "Page: Submit Position Page" . "\r\n";
	$subject="Request To Talk To A Representative";
}
 
if (isset($_REQUEST['submitposition'])){
	$pagename = "Page: Submit Position Page" . "\r\n";
	$subject="Position Submittal";
}
 
if (isset($_REQUEST['submitresume'])){
	$pagename = "Page: Submit Resume Page" . "\r\n";
	$subject="Resume Submittal";
	$emailsend = "abacusweb@abacusnyc.com"; //This email will be resumes@abacusnyc.com
}
 
if (isset($_REQUEST['submitapply'])){
	$pagename = "Page: Apply For Position Page" . "\r\n";
	$subject="Application For Position \n\n";
	$search_flag = 1;
 
	$positionhead = "Position Applied For:\r\n";
	$email_title = "Title: " . $_SESSION["title"] . "\r\n";
	$email_date = "Date: " . $_SESSION["date"] . "\r\n";
	$email_industry = "Industry: " .  $_SESSION["industry"] . "\r\n";
	$email_term = "Term: " . $_SESSION["term"] . "\r\n";
	
	if ($_SESSION["category"] == 1) {
	$email_salarylow = "Salary Low: " . $_SESSION["salary_low"]."K". "\r\n";
	$email_salaryhigh = "Salary High: " . $_SESSION["salary_high"]."K". "\r\n";
	$email_bonus = "Bonus Eligible: " . $_SESSION["bonus"] . "\r\n";	
	}
	else {
	$email_salarylow = "";
	$email_salaryhigh = "";
	$email_bonus = "";
	}
	
	if ($_SESSION["category"] == 2) {
	$email_hourlylow = "Hourly Rate Low: " . $_SESSION["hourly_low"]."\HR"."\r\n";
	$email_hourlyhigh = "Hourly Rate High: " . $_SESSION["hourly_high"]. "\HR"."\r\n";
	}
	else {
	$email_hourlylow = "";
	$email_hourlyhigh = "";
	}
 
	$email_city = "City: " . $_SESSION["city"] . "\r\n";
	$email_state = "State: " . $_SESSION["state"] . "\r\n";
	$email_group = "Position Group: " . $_SESSION["position_group"] . "\r\n";
 
}
 
if (!($_REQUEST['name'] == "")){
$name=$_REQUEST['name'];
$nameprint="Name: $name" . "\r\n";
}
else {
$nameprint="";
}
 
if (!($_REQUEST['contactname'] == "")){
$contactname=$_REQUEST['contactname'];
$contactnameprint="Contact Name: $contactname" . "\r\n";
}
else {
$contactnameprint="";
}
 
if (!($_REQUEST['companyname'] == "")){
$companyname=$_REQUEST['companyname'];
$companynameprint="Company Name: $companyname" . "\r\n";
}
else {
$companynameprint="";
}
 
if (!($_REQUEST['company'] == "")){
$company=$_REQUEST['company'];
$companyprint="Company: $company" . "\r\n";
}
else {
$companyprint="";
}
 
if (!($_REQUEST['phone'] == "")){
$phone=$_REQUEST['phone'];
$phoneprint="Phone: $phone" . "\r\n";
}
elseif (!($_REQUEST['phone1'] == "")){
$phone=$_REQUEST['phone1'];
$phoneprint="Phone: $phone" . "\r\n";
}
else {
$phoneprint="";
}
 
if (!($_REQUEST['email'] == "")){
$email=$_REQUEST['email'];
$emailprint="Email: $email" . "\r\n";
}
elseif (!($_REQUEST['email1'] == "")){
$email=$_REQUEST['email1'];
$emailprint="Email: $email" . "\r\n";
}
else {
$emailprint="";
}
 
if (!($_REQUEST['position_group'] == "")){
$position=$_REQUEST['position_group'];
$positionprint="Position: $position" . "\r\n";
}
else {
$positionprint="";
}
 
if (!($_REQUEST['industry'] == "")){
$industry=$_REQUEST['industry'];
$industryprint="Industry: $industry" . "\r\n";
}
else {
$industryprint="";
}
 
if (!($_REQUEST['permanent'] == "") OR !($_REQUEST['temporary'] == "")){
$permanent=$_REQUEST['permanent'];
$temporary=$_REQUEST['temporary'];
$type="$permanent $temporary";
$typeprint="Type: $type" . "\r\n";
}
else {
$typeprint="";
}
 
if (!($_REQUEST['candidate_employer'] == "")){
$candidate_employer=$_REQUEST['candidate_employer'];
$candidate_employerprint="Candidate or Employer: $candidate_employer" . "\r\n";
}
else {
$candidate_employerprint="";
}
 
if (!($_REQUEST['assist'] == "")){
$assist=$_REQUEST['assist'];
$assistprint="How can we assist you: $assist" . "\r\n";
}
else {
$assistprint="";
}
 
if (!($_REQUEST['anythingelse'] == "")){
$anythingelse=$_REQUEST['anythingelse'];
$anythingelseprint="Anything Else: $anythingelse" . "\r\n";
}
else {
$anythingelseprint="";
}
 
if (!($_REQUEST['position_title'] == "")){
$position_title=$_REQUEST['position_title'];
$position_titleprint="Position Title: $position_title" . "\r\n";
}
else {
$position_titleprint="";
}
 
if (!($_REQUEST['salary_range'] == "")){
$salary_range=$_REQUEST['salary_range'];
$salary_rangeprint="Salary Range: $salary_range" . "\r\n";
}
else {
$salary_rangeprint="";
}
 
if (!($_REQUEST['hourly_range'] == "")){
$hourly_range=$_REQUEST['hourly_range'];
$hourly_rangeprint="Hourly Range: $hourly_range" . "\r\n";
}
else {
$hourly_rangeprint="";
}
 
if (!($_REQUEST['describe_position'] == "")){
$describe_position=$_REQUEST['describe_position'];
$describe_positionprint="Describe Position: $describe_position" . "\r\n";
}
else {
$describe_positionprint="";
}
 
if (!($_REQUEST['comments'] == "")){
$comments=$_REQUEST['comments'];
$commentsprint="Comments/Messages: $comments" . "\r\n";
}
else {
$commentsprint="";
}
 
 
if (isset($_FILES["file1"]["name"]) AND !($_FILES["file1"]["name"] == "")){  //IF A FILES IS SUBMITTED THROUGH THE FORM THEN SEND WITH THIS
	
			if ((($_FILES["file1"]["type"] == "application/msword")
			|| ($_FILES["file1"]["type"] == "application/rtf")
			|| ($_FILES["file1"]["type"] == "application/pdf")
			|| ($_FILES["file1"]["type"] == "text/plain"))
			&& ($_FILES["file1"]["size"] < 100000))
			  {
			  if ($_FILES["file1"]["error"] > 0)
				{
				echo "Error: " . $_FILES["file1"]["error"] . "<br />";
				}
			  else
				{
				#$att_server = "attachment/".$_FILES["file1"]["name"];  
				#move_uploaded_file($_FILES["file1"]["tmp_name"], $att_server);
					
				$from = "info@abacusnyc.com";
				$to =  "$emailsend"; 
				$subject = "$subject";
				$message1="$pagename$nameprint$contactnameprint$companyprint$companynameprint$phoneprint$emailprint$positionprint$industryprint$typeprint$candidate_employerprint$assistprint$anythingelseprint$position_titleprint$salary_rangeprint$hourly_rangeprint$describe_positionprint$commentsprint$positionhead$email_title$email_date$email_industry$email_term$email_salarylow$email_salaryhigh$email_bonus$email_hourlylow$email_hourlyhigh$email_city$email_state$email_group";
				#$attachment = "attachment/".$_FILES["file1"]["name"];
				#$fileatt = $attachment; // Path to the file                  
				#$attachment_type = $_FILES["file1"]["type"]; // File Type 
				#$start=	0;
				#$attachment_name = substr(substr($attachment, 11), $start, strlen($attachment)); // Filename that will be used for the file as the 	attachment 
 
				$email_from = $from; // Who the email is from 
				$email_subject =  $subject; // The Subject of the email 
				$email_to = $to; // Who the email is to
 
				
 	// newly added section start-----------------------
				
$attachment = $_FILES['file1']['tmp_name'];
$attachment_name = $_FILES['file1']['name']; 
if (is_uploaded_file($attachment)) { // have a file uploaded?
$fp = fopen($attachment, "rb"); //Open it
$data = fread($fp, filesize($attachment)); //Read it
$data = chunk_split(base64_encode($data)); //Chunk it up and encode it as base64 so it can emailed
fclose($fp);
}
 
$headers  = "From: ABACUS GROUP<info@abacusnyc.com>\r\n";  
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/related; type=\"multipart/alternative\"; boundary=\"----=MIME_BOUNDRY_main_message\"\n"; 
$headers .= "This is a multi-part message in MIME format.\n";
$headers .= "------=MIME_BOUNDRY_main_message \n"; 
$headers .= "Content-Type: multipart/alternative; boundary=\"----=MIME_BOUNDRY_message_parts\"\n"; 
$message = "------=MIME_BOUNDRY_message_parts\n";
$message .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n"; 
$message .= "Content-Transfer-Encoding: quoted-printable\n"; 
$message .= "\n"; 
$message .="".$message1."\n";
$message .= "\n"; 
$message .= "------=MIME_BOUNDRY_message_parts--\n"; 
$message .= "\n"; 
$message .= "------=MIME_BOUNDRY_main_message\n"; 
$message .= "Content-Type: application/octet-stream;\n\tname=\"" . $attachment_name . "\"\n";
$message .= "Content-Transfer-Encoding: base64\n";
$message .= "Content-Disposition: attachment;\n\tfilename=\"" . $attachment_name . "\"\n\n";
$message .= $data; 
$message .= "\n"; 
$message .= "------=MIME_BOUNDRY_main_message--\n"; 
 
	   
	    // newly added section finish----------------------                        
	
				$ok = @mail($email_to, $email_subject, $message, $headers); 
				if($ok) { 
				} 
				else { 
					die("Sorry but the email could not be sent. Please go back and try again!"); 
					} 
				
				$sentfile = "attachment/".$_FILES["file1"]["name"];
				unlink($att_server);
				}
			  }
			else
			  {
			  echo "Invalid file";
			  }
} // END OF EMAIL FUNCTION IF
 
else { //IF NO ATTACHMENT FILE THEN USE THIS EMAIL SEND
			$to = "$emailsend"; 
			$subject = "$subject"; 
			$message1="$pagename$nameprint$contactnameprint$companyprint$companynameprint$phoneprint$emailprint$positionprint$industryprint$typeprint$candidate_employerprint$assistprint$anythingelseprint$position_titleprint$salary_rangeprint$hourly_rangeprint$describe_positionprint$commentsprint$positionhead$email_title$email_date$email_industry$email_term$email_salarylow$email_salaryhigh$email_hourlylow$email_hourlyhigh$email_bonus$email_city$email_state$email_group"; 
			$headers = "From: info@abacusnyc.com" . "\r\n" .
				"Reply-To: $email"; 
			$sent = mail($to, $subject, $message1, $headers) ; 
}
 
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>The Abacus Group &#150; Confirmation Page</title>
<!-- <script src="rollovers.js" type="text/javascript"></script> -->
<link rel="stylesheet" href="main.css" type="text/css">
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAhqj6P2utshbr5ukWrtWfphRPlMQrS4dKyplm8TdAOpAWA7pxfBSEw78KLfAxQWS6pk7ZFSfzyL3v5Q"
      type="text/javascript"></script>
    <script type="text/javascript">
    //<![CDATA[
    function load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
        map.setCenter(new GLatLng(40.751613,-73.99204), 15);
		map.addOverlay(new GMarker(new GLatLng(40.751613,-73.99204)));
      }
    }
    //]]>
</script>
 
</head>
<body onLoad="load()" onUnload="GUnload()">
 
<!-- START of DIV wrapper to center the whole page -->
 
	<div id="wrapper">  
 
	<!-- START of MainTable, this table holds the drop shadows for the outside of the page -->
 
	<table id="maintable">
	<tr>
		<td class="top" colspan="3"><img src="images/shadow_top.jpg" width="811" height="5" alt=""></td>
	</tr>
	<tr>
		<td class="sideleft"><img src="images/spacer.gif" width="5" height="1" alt=""></td>
		<td class="content">
	<!-- \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -->
	<!-- START of HEADER TABLE -->
	<!-- \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -->
	<table id="headertable">
	<tr>
		<td class="left"><img src="images/logo.jpg" width="580" height="66" alt="Abacus Group Logo"></td>
		<td class="right"><form action="positions.php" method="POST" name="form1"><img src="images/spacer.gif" width="1" height="20" alt=""><br />SEARCH JOBS<br /><img src="images/spacer.gif" width="1" height="3" alt=""><br />
						<select name="top_position_group" class="topsearch">
						<option value="" selected>Select a position/title</option>";
					<?php
					while($row = mysql_fetch_array($resulttop))	{
						echo"<option value=\"$row[id]\">$row[groupname]</option>";
						}  ?>
						</select><input type=image align=middle SRC="images/go.gif"><br />&nbsp;<br />
						<a href="submit_position.php" class="topright">SUBMIT POSITION</a>&nbsp;&nbsp;<a href="submit_resume.php" class="topright">SUBMIT RESUME</a></form></td>
	</tr>
	</table>
	<table id="navtable">
	<tr>
		<td class="top"><img src="images/spacer.gif" width="1" height="1" alt=""></td>
	</tr>
	<tr>
		<td class="mid"><a href="index.php"><img src="images/nav/nav_01.jpg" width="93" height="33" border="0" alt="Home"></a><a href="about.php"><img src="images/nav/nav_02.jpg" width="114" height="33" border="0" alt="About Us"></a><a href="employers.php"><img src="images/nav/nav_03.jpg" width="124" height="33" border="0" alt="Employers"></a><a href="candidates.php"><img src="images/nav/nav_04.jpg" width="131" height="33" border="0" alt="candidates"></a><a href="positions.php"><img src="images/nav/nav_05.jpg" width="195" height="33" border="0" alt="Current Positions"></a><a href="contact.php"><img src="images/nav/nav_06.jpg" width="144" height="33" border="0" alt="Contact Us"></a></td>
	</tr>
	<tr>
		<td class="bottom"><img src="images/spacer.gif" width="1" height="3" alt=""></td>
	</tr>
	</table>
	<table id="bannertable">
	<?php 
	if (isset($_REQUEST['submitposition'])){
		echo "<tr><td class=\"top\"><img src=\"images/submit/submit_pic.jpg\" width=\"801\" height=\"90\" alt=\"Submit Position Pic\"></td></tr><tr><td class=\"mid\"><img src=\"images/submit/submit_title.jpg\" width=\"801\" height=\"35\" alt=\"Submit Position Title\"></td></tr>";
		$background = "images/submit/submit_desc_bg.jpg";
	}
	elseif (isset($_REQUEST['submitresume'])){
		echo "<tr><td class=\"top\"><img src=\"images/resume/submit_pic.jpg\" width=\"801\" height=\"90\" alt=\"Submit Resume Pic\"></td></tr><tr><td class=\"mid\"><img src=\"images/resume/submit_title.jpg\" width=\"801\" height=\"35\" alt=\"Submit Resume\"></td></tr>";
		$background = "images/resume/submit_desc_bg.jpg";
	}
	elseif (isset($_REQUEST['submitapply'])){
		echo "<tr><td class=\"top\"><img src=\"images/apply/submit_pic.jpg\" width=\"801\" height=\"90\" alt=\"Apply Pic\"></td></tr><tr><td class=\"mid\"><img src=\"images/apply/apply_title.jpg\" width=\"801\" height=\"35\" alt=\"Apply Title\"></td></tr>";
		$background = "images/resume/submit_desc_bg.jpg";
	}
	else {
		echo "<tr><td class=\"top\"><img src=\"images/contact/contact_pic.jpg\" width=\"801\" height=\"90\" alt=\"Contact Pic\"></td></tr><tr><td class=\"mid\"><img src=\"images/contact/contact_title.jpg\" width=\"801\" height=\"35\" alt=\"Contact Title\"></td></tr>";
		$background = "images/contact/contact_desc_bg.jpg";
	}
	?>
	
	<tr>	
		<td class="bottom" height="107" style="background: url(<?php echo "$background"; ?>);"><p>Please feel free to contact one of our consultants about your career search or staffing needs. </p></td>
	</tr>
	</table>
	<!-- START of the main CONTENT TABLE, this table holds the smaller tables that make up the main content window -->
	<table id="contenttable">
	<tr>
		<!-- START the LEFT content the td holds all the stuff in the left column -->
		<td class="left">
			<div> <!--  DIV tag For IE to center the TD Cell --->
			<!-- This table is a smaller table used to hold the boxed info for this column in here are the drop shaddows for this box -->
			<p class="contact">
             <span class="abacus">THE ABACUS GROUP</span><br />
			 14 Penn Plaza, Suite 1600<br />
			 New York, NY 10122<br />
			 &nbsp;<br />
			 <b>phone </b>212.812.8444<br />
			 <b>fax </b>212.812.8448<br />
			 <b>e-mail </b><a href="mailto:info@abacusnyc.com" class="contact">info@abacusnyc.com</a></p>
			 <div id="map" style="width: 211px; height: 145px; margin: 0 38px 0 38px;"></div>
			 <p class="map"><a href="http://maps.google.com/maps?q=14+Penn+Plaza,+New+York,+NY+10001,+USA&sa=X&oi=map&ct=title" target="_blank" class="map">Map & Driving Directions</a></p>
			
			<!-- End of this smallbox -->
			</div>
		</td>
		<!-- START of the content that goes on the LEFT side of the main content window -->
		<td class="right">
		<h1>THANK YOU</h1>
		<p class="text">
		<?php 
		if($sent OR $ok) 
			{print "Your email was sent successfully"; }
		else 
			{print "We encountered an error sending your mail"; }
		?>
		<?php if($search_flag == 1){ 
		echo "<br />&nbsp;<br />";
		echo "<a href=\"$search_url\" class=\"positionheader\">back to search results &#62;&#62;</a>";
		}?>
		</p>
		</td>
		<!-- End of the LEFT side content -->
	</tr>	
	</table>
	<!-- End of the CONTENT TABLE -->
	<br />
	<!-- \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -->
	<!-- START of FOOTER TABLE -->
	<!-- \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -->
	<table id="footertable">
	<tr>
		<td class="top" colspan="2"><img src="images/count_on_us.jpg" width="79" height="13" alt="count on us"></td>
	</tr>
	<tr>
		<td class="mid" colspan="2"><hr></td>
	</tr>
	<tr>	
		<td class="bottomleft"><img src="images/spacer.gif" width="1" height="1" alt=""><br /><a href="privacy.html" class="footer">privacy policy</a><img src="images/dots.gif" width="23" height="18" alt="dots" align="middle"><a href="sitemap.html" class="footer">site map</a></td>
		<td class="bottomright"><p>14 penn plaza, suite 1600, new york, new york 10122<br />
		<b><i>telephone</i></b> 212.812.8444 &#149; <b><i>fax</i></b> 212.812.8448 &#149; <a href="mailto:info@abacusnyc.com" class="email">info@abacusnyc.com</a></p></td>
	</tr>
	</table>
	<!-- \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -->
	<!-- END of CONTENT TABLE -->
	<!-- \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -->
 
	<br />
	</td>
	<td class="sideright"></td>
	</tr>
	<tr>
		<td class="top" colspan="3"><img src="images/shadow_bottom.jpg" width="811" height="5" alt=""></td>
	</tr>
	</table>
	<!-- END of MAIN TABLE -->
	</div>
	<!-- END of DIV for wrapper -->	
 
 
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-5821975-1");
pageTracker._trackPageview();
</script></BODY>
</HTML>
<?php
include 'closedb.php';
?> 

Open in new window

0
hieloCommented:
>> that is not currently working.
elaborate.
0
hieloCommented:
not emailing? Not querying the db? emailing but data is blank? Sending data from form but not from db? not saving data to db?...
0
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

jsuissaAuthor Commented:
Hi,

Just to add more informration regarding the problem. It does confirm that the e-mail went through online, but it dosen't actually send an e-mail. All the other forms on the site send the e-mail with the correct form fields in the body of the e-mail.

Best,

Justin
0
jsuissaAuthor Commented:
One other piece of information to add is that we solved part of the issue with already -- the second form is submitted to confirmationt.php and the name of the file should be confirmation.php. Still no luck though.
0
Bruce PieterseTechnical LeadCommented:
Hi Jsuissa,

Could you post confirmation.php as well?

Thanks
0
jsuissaAuthor Commented:
<?php

session_start();

$position = $_SESSION['position_group'];
$search_url = $_SESSION["PositionsSearchURL"];

if ($position == "") {
      $position == "none";
}

include 'config.php';
include 'opendb.php';
$groupstop  = "SELECT id, groupname, status FROM groups WHERE status = 1 ORDER BY groupname ASC";
$resulttop = mysql_query($groupstop);
$groups  = "SELECT id, groupname, email, status FROM groups WHERE groupname = '$position' AND status = 1";
$result1 = mysql_query($groups);
$industries  = "SELECT id, name, short, status FROM industries WHERE status = 1";
$result2 = mysql_query($industries);
$locations  = "SELECT id, city, state, status FROM locations WHERE status = 1";
$result3 = mysql_query($locations);

$rowgroup = mysql_fetch_array($result1);

$emailsend = "abacusweb@abacusnyc.com";  //This email will be abacusweb@abacusnyc.com

if(mysql_num_rows($result1) == 1) {
      $emailsend = $rowgroup["email"];
}

if (isset($_REQUEST['employers'])){
      $pagename = "Page: Employer Page" . "\r\n";
      $subject="Request To Talk To A Representative";
}

if (isset($_REQUEST['contact'])){
      $pagename = "Page: Contact Us Page" . "\r\n";
      $subject="Request To Talk To A Representative";
}

if (isset($_REQUEST['submit'])){
      $pagename = "Page: Submit Position Page" . "\r\n";
      $subject="Request To Talk To A Representative";
}

if (isset($_REQUEST['submitposition'])){
      $pagename = "Page: Submit Position Page" . "\r\n";
      $subject="Position Submittal";
}

if (isset($_REQUEST['submitresume'])){
      $pagename = "Page: Submit Resume Page" . "\r\n";
      $subject="Resume Submittal";
      $emailsend = "abacusweb@abacusnyc.com"; //This email will be resumes@abacusnyc.com
}

if (isset($_REQUEST['submitapply'])){
      $pagename = "Page: Apply For Position Page" . "\r\n";
      $subject="Application For Position \n\n";
      $search_flag = 1;

      $positionhead = "Position Applied For:\r\n";
      $email_title = "Title: " . $_SESSION["title"] . "\r\n";
      $email_date = "Date: " . $_SESSION["date"] . "\r\n";
      $email_industry = "Industry: " .  $_SESSION["industry"] . "\r\n";
      $email_term = "Term: " . $_SESSION["term"] . "\r\n";
      
      if ($_SESSION["category"] == 1) {
      $email_salarylow = "Salary Low: " . $_SESSION["salary_low"]."K". "\r\n";
      $email_salaryhigh = "Salary High: " . $_SESSION["salary_high"]."K". "\r\n";
      $email_bonus = "Bonus Eligible: " . $_SESSION["bonus"] . "\r\n";      
      }
      else {
      $email_salarylow = "";
      $email_salaryhigh = "";
      $email_bonus = "";
      }
      
      if ($_SESSION["category"] == 2) {
      $email_hourlylow = "Hourly Rate Low: " . $_SESSION["hourly_low"]."\HR"."\r\n";
      $email_hourlyhigh = "Hourly Rate High: " . $_SESSION["hourly_high"]. "\HR"."\r\n";
      }
      else {
      $email_hourlylow = "";
      $email_hourlyhigh = "";
      }

      $email_city = "City: " . $_SESSION["city"] . "\r\n";
      $email_state = "State: " . $_SESSION["state"] . "\r\n";
      $email_group = "Position Group: " . $_SESSION["position_group"] . "\r\n";

}

if (!($_REQUEST['name'] == "")){
$name=$_REQUEST['name'];
$nameprint="Name: $name" . "\r\n";
}
else {
$nameprint="";
}

if (!($_REQUEST['contactname'] == "")){
$contactname=$_REQUEST['contactname'];
$contactnameprint="Contact Name: $contactname" . "\r\n";
}
else {
$contactnameprint="";
}

if (!($_REQUEST['companyname'] == "")){
$companyname=$_REQUEST['companyname'];
$companynameprint="Company Name: $companyname" . "\r\n";
}
else {
$companynameprint="";
}

if (!($_REQUEST['company'] == "")){
$company=$_REQUEST['company'];
$companyprint="Company: $company" . "\r\n";
}
else {
$companyprint="";
}

if (!($_REQUEST['phone'] == "")){
$phone=$_REQUEST['phone'];
$phoneprint="Phone: $phone" . "\r\n";
}
elseif (!($_REQUEST['phone1'] == "")){
$phone=$_REQUEST['phone1'];
$phoneprint="Phone: $phone" . "\r\n";
}
else {
$phoneprint="";
}

if (!($_REQUEST['email'] == "")){
$email=$_REQUEST['email'];
$emailprint="Email: $email" . "\r\n";
}
elseif (!($_REQUEST['email1'] == "")){
$email=$_REQUEST['email1'];
$emailprint="Email: $email" . "\r\n";
}
else {
$emailprint="";
}

if (!($_REQUEST['position_group'] == "")){
$position=$_REQUEST['position_group'];
$positionprint="Position: $position" . "\r\n";
}
else {
$positionprint="";
}

if (!($_REQUEST['industry'] == "")){
$industry=$_REQUEST['industry'];
$industryprint="Industry: $industry" . "\r\n";
}
else {
$industryprint="";
}

if (!($_REQUEST['permanent'] == "") OR !($_REQUEST['temporary'] == "")){
$permanent=$_REQUEST['permanent'];
$temporary=$_REQUEST['temporary'];
$type="$permanent $temporary";
$typeprint="Type: $type" . "\r\n";
}
else {
$typeprint="";
}

if (!($_REQUEST['candidate_employer'] == "")){
$candidate_employer=$_REQUEST['candidate_employer'];
$candidate_employerprint="Candidate or Employer: $candidate_employer" . "\r\n";
}
else {
$candidate_employerprint="";
}

if (!($_REQUEST['assist'] == "")){
$assist=$_REQUEST['assist'];
$assistprint="How can we assist you: $assist" . "\r\n";
}
else {
$assistprint="";
}

if (!($_REQUEST['anythingelse'] == "")){
$anythingelse=$_REQUEST['anythingelse'];
$anythingelseprint="Anything Else: $anythingelse" . "\r\n";
}
else {
$anythingelseprint="";
}

if (!($_REQUEST['position_title'] == "")){
$position_title=$_REQUEST['position_title'];
$position_titleprint="Position Title: $position_title" . "\r\n";
}
else {
$position_titleprint="";
}

if (!($_REQUEST['salary_range'] == "")){
$salary_range=$_REQUEST['salary_range'];
$salary_rangeprint="Salary Range: $salary_range" . "\r\n";
}
else {
$salary_rangeprint="";
}

if (!($_REQUEST['hourly_range'] == "")){
$hourly_range=$_REQUEST['hourly_range'];
$hourly_rangeprint="Hourly Range: $hourly_range" . "\r\n";
}
else {
$hourly_rangeprint="";
}

if (!($_REQUEST['describe_position'] == "")){
$describe_position=$_REQUEST['describe_position'];
$describe_positionprint="Describe Position: $describe_position" . "\r\n";
}
else {
$describe_positionprint="";
}

if (!($_REQUEST['comments'] == "")){
$comments=$_REQUEST['comments'];
$commentsprint="Comments/Messages: $comments" . "\r\n";
}
else {
$commentsprint="";
}


if (isset($_FILES["file1"]["name"]) AND !($_FILES["file1"]["name"] == "")){  //IF A FILES IS SUBMITTED THROUGH THE FORM THEN SEND WITH THIS
      
                  if ((($_FILES["file1"]["type"] == "application/msword")
                  || ($_FILES["file1"]["type"] == "application/rtf")
                  || ($_FILES["file1"]["type"] == "application/pdf")
                  || ($_FILES["file1"]["type"] == "text/plain"))
                  && ($_FILES["file1"]["size"] < 100000))
                    {
                    if ($_FILES["file1"]["error"] > 0)
                        {
                        echo "Error: " . $_FILES["file1"]["error"] . "<br />";
                        }
                    else
                        {
                        #$att_server = "attachment/".$_FILES["file1"]["name"];  
                        #move_uploaded_file($_FILES["file1"]["tmp_name"], $att_server);
                              
                        $from = "info@abacusnyc.com";
                        $to =  "$emailsend";
                        $subject = "$subject";
                        $message1="$pagename$nameprint$contactnameprint$companyprint$companynameprint$phoneprint$emailprint$positionprint$industryprint$typeprint$candidate_employerprint$assistprint$anythingelseprint$position_titleprint$salary_rangeprint$hourly_rangeprint$describe_positionprint$commentsprint$positionhead$email_title$email_date$email_industry$email_term$email_salarylow$email_salaryhigh$email_bonus$email_hourlylow$email_hourlyhigh$email_city$email_state$email_group";
                        #$attachment = "attachment/".$_FILES["file1"]["name"];
                        #$fileatt = $attachment; // Path to the file                  
                        #$attachment_type = $_FILES["file1"]["type"]; // File Type
                        #$start=      0;
                        #$attachment_name = substr(substr($attachment, 11), $start, strlen($attachment)); // Filename that will be used for the file as the       attachment

                        $email_from = $from; // Who the email is from
                        $email_subject =  $subject; // The Subject of the email
                        $email_to = $to; // Who the email is to
 
                        
       // newly added section start-----------------------
                        
$attachment = $_FILES['file1']['tmp_name'];
$attachment_name = $_FILES['file1']['name'];
if (is_uploaded_file($attachment)) { // have a file uploaded?
$fp = fopen($attachment, "rb"); //Open it
$data = fread($fp, filesize($attachment)); //Read it
$data = chunk_split(base64_encode($data)); //Chunk it up and encode it as base64 so it can emailed
fclose($fp);
}

$headers  = "From: ABACUS GROUP<info@abacusnyc.com>\r\n";  
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/related; type=\"multipart/alternative\"; boundary=\"----=MIME_BOUNDRY_main_message\"\n";
$headers .= "This is a multi-part message in MIME format.\n";
$headers .= "------=MIME_BOUNDRY_main_message \n";
$headers .= "Content-Type: multipart/alternative; boundary=\"----=MIME_BOUNDRY_message_parts\"\n";
$message = "------=MIME_BOUNDRY_message_parts\n";
$message .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n";
$message .= "Content-Transfer-Encoding: quoted-printable\n";
$message .= "\n";
$message .="".$message1."\n";
$message .= "\n";
$message .= "------=MIME_BOUNDRY_message_parts--\n";
$message .= "\n";
$message .= "------=MIME_BOUNDRY_main_message\n";
$message .= "Content-Type: application/octet-stream;\n\tname=\"" . $attachment_name . "\"\n";
$message .= "Content-Transfer-Encoding: base64\n";
$message .= "Content-Disposition: attachment;\n\tfilename=\"" . $attachment_name . "\"\n\n";
$message .= $data;
$message .= "\n";
$message .= "------=MIME_BOUNDRY_main_message--\n";

        
          // newly added section finish----------------------                        
      
                        $ok = @mail($email_to, $email_subject, $message, $headers);
                        if($ok) {
                        }
                        else {
                              die("Sorry but the email could not be sent. Please go back and try again!");
                              }
                        
                        $sentfile = "attachment/".$_FILES["file1"]["name"];
                        unlink($att_server);
                        }
                    }
                  else
                    {
                    echo "Invalid file";
                    }
} // END OF EMAIL FUNCTION IF

else { //IF NO ATTACHMENT FILE THEN USE THIS EMAIL SEND
                  $to = "$emailsend";
                  $subject = "$subject";
                  $message1="$pagename$nameprint$contactnameprint$companyprint$companynameprint$phoneprint$emailprint$positionprint$industryprint$typeprint$candidate_employerprint$assistprint$anythingelseprint$position_titleprint$salary_rangeprint$hourly_rangeprint$describe_positionprint$commentsprint$positionhead$email_title$email_date$email_industry$email_term$email_salarylow$email_salaryhigh$email_hourlylow$email_hourlyhigh$email_bonus$email_city$email_state$email_group";
                  $headers = "From: info@abacusnyc.com" . "\r\n" .
                        "Reply-To: $email";
                  $sent = mail($to, $subject, $message1, $headers) ;
}

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>The Abacus Group &#150; Confirmation Page</title>
<!-- <script src="rollovers.js" type="text/javascript"></script> -->
<link rel="stylesheet" href="main.css" type="text/css">
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAhqj6P2utshbr5ukWrtWfphRPlMQrS4dKyplm8TdAOpAWA7pxfBSEw78KLfAxQWS6pk7ZFSfzyL3v5Q"
      type="text/javascript"></script>
    <script type="text/javascript">
    //<![CDATA[
    function load() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map"));
        map.setCenter(new GLatLng(40.751613,-73.99204), 15);
            map.addOverlay(new GMarker(new GLatLng(40.751613,-73.99204)));
      }
    }
    //]]>
</script>

</head>
<body onLoad="load()" onUnload="GUnload()">

<!-- START of DIV wrapper to center the whole page -->

      <div id="wrapper">  

      <!-- START of MainTable, this table holds the drop shadows for the outside of the page -->

      <table id="maintable">
      <tr>
            <td class="top" colspan="3"><img src="images/shadow_top.jpg" width="811" height="5" alt=""></td>
      </tr>
      <tr>
            <td class="sideleft"><img src="images/spacer.gif" width="5" height="1" alt=""></td>
            <td class="content">
      <!-- \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -->
      <!-- START of HEADER TABLE -->
      <!-- \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -->
      <table id="headertable">
      <tr>
            <td class="left"><img src="images/logo.jpg" width="580" height="66" alt="Abacus Group Logo"></td>
            <td class="right"><form action="positions.php" method="POST" name="form1"><img src="images/spacer.gif" width="1" height="20" alt=""><br />SEARCH JOBS<br /><img src="images/spacer.gif" width="1" height="3" alt=""><br />
                                    <select name="top_position_group" class="topsearch">
                                    <option value="" selected>Select a position/title</option>";
                              <?php
                              while($row = mysql_fetch_array($resulttop))      {
                                    echo"<option value=\"$row[id]\">$row[groupname]</option>";
                                    }  ?>
                                    </select><input type=image align=middle SRC="images/go.gif"><br />&nbsp;<br />
                                    <a href="submit_position.php" class="topright">SUBMIT POSITION</a>&nbsp;&nbsp;<a href="submit_resume.php" class="topright">SUBMIT RESUME</a></form></td>
      </tr>
      </table>
      <table id="navtable">
      <tr>
            <td class="top"><img src="images/spacer.gif" width="1" height="1" alt=""></td>
      </tr>
      <tr>
            <td class="mid"><a href="index.php"><img src="images/nav/nav_01.jpg" width="93" height="33" border="0" alt="Home"></a><a href="about.php"><img src="images/nav/nav_02.jpg" width="114" height="33" border="0" alt="About Us"></a><a href="employers.php"><img src="images/nav/nav_03.jpg" width="124" height="33" border="0" alt="Employers"></a><a href="candidates.php"><img src="images/nav/nav_04.jpg" width="131" height="33" border="0" alt="candidates"></a><a href="positions.php"><img src="images/nav/nav_05.jpg" width="195" height="33" border="0" alt="Current Positions"></a><a href="contact.php"><img src="images/nav/nav_06.jpg" width="144" height="33" border="0" alt="Contact Us"></a></td>
      </tr>
      <tr>
            <td class="bottom"><img src="images/spacer.gif" width="1" height="3" alt=""></td>
      </tr>
      </table>
      <table id="bannertable">
      <?php
      if (isset($_REQUEST['submitposition'])){
            echo "<tr><td class=\"top\"><img src=\"images/submit/submit_pic.jpg\" width=\"801\" height=\"90\" alt=\"Submit Position Pic\"></td></tr><tr><td class=\"mid\"><img src=\"images/submit/submit_title.jpg\" width=\"801\" height=\"35\" alt=\"Submit Position Title\"></td></tr>";
            $background = "images/submit/submit_desc_bg.jpg";
      }
      elseif (isset($_REQUEST['submitresume'])){
            echo "<tr><td class=\"top\"><img src=\"images/resume/submit_pic.jpg\" width=\"801\" height=\"90\" alt=\"Submit Resume Pic\"></td></tr><tr><td class=\"mid\"><img src=\"images/resume/submit_title.jpg\" width=\"801\" height=\"35\" alt=\"Submit Resume\"></td></tr>";
            $background = "images/resume/submit_desc_bg.jpg";
      }
      elseif (isset($_REQUEST['submitapply'])){
            echo "<tr><td class=\"top\"><img src=\"images/apply/submit_pic.jpg\" width=\"801\" height=\"90\" alt=\"Apply Pic\"></td></tr><tr><td class=\"mid\"><img src=\"images/apply/apply_title.jpg\" width=\"801\" height=\"35\" alt=\"Apply Title\"></td></tr>";
            $background = "images/resume/submit_desc_bg.jpg";
      }
      else {
            echo "<tr><td class=\"top\"><img src=\"images/contact/contact_pic.jpg\" width=\"801\" height=\"90\" alt=\"Contact Pic\"></td></tr><tr><td class=\"mid\"><img src=\"images/contact/contact_title.jpg\" width=\"801\" height=\"35\" alt=\"Contact Title\"></td></tr>";
            $background = "images/contact/contact_desc_bg.jpg";
      }
      ?>
      
      <tr>      
            <td class="bottom" height="107" style="background: url(<?php echo "$background"; ?>);"><p>Please feel free to contact one of our consultants about your career search or staffing needs. </p></td>
      </tr>
      </table>
      <!-- START of the main CONTENT TABLE, this table holds the smaller tables that make up the main content window -->
      <table id="contenttable">
      <tr>
            <!-- START the LEFT content the td holds all the stuff in the left column -->
            <td class="left">
                  <div> <!--  DIV tag For IE to center the TD Cell --->
                  <!-- This table is a smaller table used to hold the boxed info for this column in here are the drop shaddows for this box -->
                  <p class="contact">
             <span class="abacus">THE ABACUS GROUP</span><br />
                   14 Penn Plaza, Suite 1600<br />
                   New York, NY 10122<br />
                   &nbsp;<br />
                   <b>phone </b>212.812.8444<br />
                   <b>fax </b>212.812.8448<br />
                   <b>e-mail </b><a href="mailto:info@abacusnyc.com" class="contact">info@abacusnyc.com</a></p>
                   <div id="map" style="width: 211px; height: 145px; margin: 0 38px 0 38px;"></div>
                   <p class="map"><a href="http://maps.google.com/maps?q=14+Penn+Plaza,+New+York,+NY+10001,+USA&sa=X&oi=map&ct=title" target="_blank" class="map">Map & Driving Directions</a></p>
                  
                  <!-- End of this smallbox -->
                  </div>
            </td>
            <!-- START of the content that goes on the LEFT side of the main content window -->
            <td class="right">
            <h1>THANK YOU</h1>
            <p class="text">
            <?php
            if($sent OR $ok)
                  {print "Your email was sent successfully"; }
            else
                  {print "We encountered an error sending your mail"; }
            ?>
            <?php if($search_flag == 1){
            echo "<br />&nbsp;<br />";
            echo "<a href=\"$search_url\" class=\"positionheader\">back to search results &#62;&#62;</a>";
            }?>
            </p>
            </td>
            <!-- End of the LEFT side content -->
      </tr>      
      </table>
      <!-- End of the CONTENT TABLE -->
      <br />
      <!-- \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -->
      <!-- START of FOOTER TABLE -->
      <!-- \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -->
      <table id="footertable">
      <tr>
            <td class="top" colspan="2"><img src="images/count_on_us.jpg" width="79" height="13" alt="count on us"></td>
      </tr>
      <tr>
            <td class="mid" colspan="2"><hr></td>
      </tr>
      <tr>      
            <td class="bottomleft"><img src="images/spacer.gif" width="1" height="1" alt=""><br /><a href="privacy.html" class="footer">privacy policy</a><img src="images/dots.gif" width="23" height="18" alt="dots" align="middle"><a href="sitemap.html" class="footer">site map</a></td>
            <td class="bottomright"><p>14 penn plaza, suite 1600, new york, new york 10122<br />
            <b><i>telephone</i></b> 212.812.8444 &#149; <b><i>fax</i></b> 212.812.8448 &#149; <a href="mailto:info@abacusnyc.com" class="email">info@abacusnyc.com</a></p></td>
      </tr>
      </table>
      <!-- \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -->
      <!-- END of CONTENT TABLE -->
      <!-- \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -->

      <br />
      </td>
      <td class="sideright"></td>
      </tr>
      <tr>
            <td class="top" colspan="3"><img src="images/shadow_bottom.jpg" width="811" height="5" alt=""></td>
      </tr>
      </table>
      <!-- END of MAIN TABLE -->
      </div>
      <!-- END of DIV for wrapper -->      


<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-5821975-1");
pageTracker._trackPageview();
</script></BODY>
</HTML>
<?php
include 'closedb.php';
?>
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.