Jump to content

Problem with form handling script


madmark33

Recommended Posts

I'm new to PHP and am trying to use it to forward completed forms from a website I am designing. My problem is that for some reason I am not receiving the emails that are supposed to be forwarded by my script. I will post all the code below so that you can see what I've done. I added an email error check just to make sure the emails are being succesfully forwarded and so far I am receiving success messages, but then when I check my inbox I have not received any emails. I am hosting the website through Godaddy.com and they are supposed to support PHP so I don't understand why I am not receiving the emails. I think there may b e something wrong with my code but my knowledge is very limited so I figured it would be best to ask some people who know better than I do. Here is the code. Any help would be appreciated. Don't be afraid to blast my code, I'm new to this and I'm sure it's not pretty but I appreciate constructive criticism. Thanks!

 

<?php

 

/* Subject and Email Variables */

 

$emailSubject = 'Web Submitted Design Analysis';

$webMaster = '[email protected]';

 

/* Gathering Data Variables */

 

$companyField = $_POST['company'];

$dateField = $_POST['date'];

$phoneField = $_POST['phone'];

$faxField = $_POST['fax'];

$emailField = $_POST['email'];

$streetField = $_POST['street'];

$designField = $_POST['design'];

$nppyField = $_POST['nppy'];

$criticaldimensionsField = $_POST['criticaldimensions'];

$warpField = $_POST['warp'];

$criticalloadsField = $_POST['criticalloads'];

$impactrequirementsField = $_POST['impactrequirements'];

$insertstrengthField = $_POST['insertstrength'];

$dielectricField = $_POST['dielectric'];

$arcField = $_POST['arc'];

$heatField = $_POST['heat'];

$cosmeticsurfacesField = $_POST['cosmeticsurfaces'];

$cryogenicField = $_POST['cryogenic'];

$chemicalresistanceField = $_POST['chemicalresistance'];

$weatheringField = $_POST['weathering'];

$wearField = $_POST['wear'];

$pvfactorField = $_POST['pvfactor'];

$materialsField = $_POST['materials'];

$dimensionalField = $_POST['dimensional'];

$physicalField = $_POST['physical'];

$electricalField = $_POST['electrical'];

$otherField = $_POST['other'];

$detailedspecField = $_POST['detailedspec'];

$dieavailableField = $_POST['dieavailable'];

$fourslideField = $_POST['fourslide'];

$speedscrewsField = $_POST['speedscrews'];

$moldsField = $_POST['molds'];

$automationField = $_POST['automation'];

$engineeringphoneField = $_POST['engineeringphone'];

$purchasingphoneField = $_POST['purchasingphone'];

$productionphoneField = $_POST['productionphone'];

 

$body = <<<EOD

<br><hr><br>

<h2>Design Analysis Submittal from    $company </h2><br>

<br>

Company: $company <br>

Date: $date <br>

Phone: $phone <br>

Fax: $fax <br>

e-Mail: $email <br>

Street: $street <br>

Design Description: $design <br>

Number of Parts/Year: $nppy <br><br>

<U>Phyical Requirements</U>

Critical Dimensions: $criticaldimensions <br>

Warp, flatness required: $warp <br>

Critical loads: $criticalloads <br>

Impact requirments: $impactrequirements <br>

Insert strength: $insertstrength <br><br>

<U>Electrical Requirements</U>

Dielectric strength, operating voltage: $dielectric <br>

Is arc resistance, track resistance, etc. important?: $arc <br>

What are heat and FR requirements?: $heat <br>

<U>Appearance Requirements</U>

Cosmetic surface requirements: $cosmeticsurfaces <br>

<U>Additional Factors to Consider</U>

Is this a cryogenic application?: $cryogenic <br>

Chemical resistance: $chemicalresistance <br>

Weathering (outdoor/UV): $weathering <br>

Wear resistance/rotation: $wear <br>

PV factor: $pvfactor <br>

Additional materials being considered: $materials <br>

What test will you perform on first samples?

Dimensional: $dimensional <br>

Physical: $physical <br>

Electrical: $electrical <br>

Other: $other <br>

Do you have any detailed spec that this part must meet?: $detailedspec <br>

If yes, a copy of the spec should be emailed to [email protected]. <br>

Is an existing mold or die casting die available?: $dieavailable <br>

<U>More Manufacturing Capabilities</U>

Fourslide parts: $fourslide <br>

Precision designed speedscrews: $speedscrews <br>

Molds,dies,jigs,fixtures: $molds <br>

Design, build automation equipment with robots/laser/video: $automation <br>

Purchasing Phone Number: $purchasingphone <br>

Engineering Phone Number: $engineeringphone <br>

Production Phone Number: $productionphone <br>

<br>

This conludes the Design Analysis Submittal

EOD;

 

 

$headers = "From: $email\r\n";

$headers .= "Content-type: text/html\r\n";

$success = mail($webMaster, $emailSubject, $body, $headers);

 

if(mail($webMaster,$emailSubject,$body,$headers)) {

echo "An e-mail was sent to $webMaster with the subject: $emailSubject";

} else {

echo "There was a problem sending the mail. Check your code and make sure that the e-mail address $webMaster is valid";

}

 

/* Results rendered as HTML */

 

$theResults = <<<EOD

<html>

<head>

<title>PL Pellien Composition</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script type="text/javascript">

<!--

function MM_preloadImages() { //v3.0

  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

    if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}

}

 

function MM_findObj(n, d) { //v4.01

  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);

  if(!x && d.getElementById) x=d.getElementById(n); return x;

}

 

function MM_nbGroup(event, grpName) { //v6.0

  var i,img,nbArr,args=MM_nbGroup.arguments;

  if (event == "init" && args.length > 2) {

    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {

      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;

      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();

      nbArr[nbArr.length] = img;

      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args)) != null) {

        if (!img.MM_up) img.MM_up = img.src;

        img.src = img.MM_dn = args[i+1];

        nbArr[nbArr.length] = img;

    } }

  } else if (event == "over") {

    document.MM_nbOver = nbArr = new Array();

    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args)) != null) {

      if (!img.MM_up) img.MM_up = img.src;

      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);

      nbArr[nbArr.length] = img;

    }

  } else if (event == "out" ) {

    for (i=0; i < document.MM_nbOver.length; i++) {

      img = document.MM_nbOver; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }

  } else if (event == "down") {

    nbArr = document[grpName];

    if (nbArr)

      for (i=0; i < nbArr.length; i++) { img=nbArr; img.src = img.MM_up; img.MM_dn = 0; }

    document[grpName] = nbArr = new Array();

    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args)) != null) {

      if (!img.MM_up) img.MM_up = img.src;

      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;

      nbArr[nbArr.length] = img;

  } }

}

//-->

</script>

</head>

<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('Buttons/Services-Rollover.gif','Buttons/Quote-Rollover.gif','Buttons/Contact-Rollover.gif','Buttons/About-Rollover.gif')">

<!-- ImageReady Slices (PL Pellien Composition.psd) -->

<table id="Table_01" width="1025" height="768" border="0" cellpadding="0" cellspacing="0">

<tr>

<td colspan="2"><img src="images/Header.gif" width="800" height="117" alt=""></td>

  <td rowspan="5">

<img src="images/Right-Bar.gif" width="224" height="768" alt=""></td>

<td>

<img src="file:///F|/PL Pelien Website/Composition/Pages/images/spacer.gif" width="1" height="117" alt=""></td>

</tr>

<tr>

<td><table border="0" cellpadding="0" cellspacing="0">

  <tr>

    <td><a href="index.html" target="_top" onClick="MM_nbGroup('down','group1','Services','',1)" onMouseOver="MM_nbGroup('over','Services','Buttons/Services-Rollover.gif','',1)" onMouseOut="MM_nbGroup('out')"><img src="Buttons/Services-Button.gif" alt="" name="Services" width="153" height="67" border="0" onload=""></a></td>

      </tr>

  <tr>

    <td><a href="Quote.html" target="_top" onClick="MM_nbGroup('down','group1','Quote','',1)" onMouseOver="MM_nbGroup('over','Quote','Buttons/Quote-Rollover.gif','',1)" onMouseOut="MM_nbGroup('out')"><img src="Buttons/Quote-Button.gif" alt="" name="Quote" width="153" height="59" border="0" onload=""></a></td>

      </tr>

  <tr>

    <td><a href="Contact.html" target="_top" onClick="MM_nbGroup('down','group1','Contact','',1)" onMouseOver="MM_nbGroup('over','Contact','Buttons/Contact-Rollover.gif','',1)" onMouseOut="MM_nbGroup('out')"><img src="Buttons/Contact-Button.gif" alt="" name="Contact" width="153" height="56" border="0" onload=""></a></td>

      </tr>

  <tr>

    <td><a href="About.html" target="_top" onClick="MM_nbGroup('down','group1','About','',1)" onMouseOver="MM_nbGroup('over','About','Buttons/About-Rollover.gif','',1)" onMouseOut="MM_nbGroup('out')"><img src="Buttons/About-Button.gif" alt="" name="About" width="153" height="60" border="0" onload=""></a></td>

      </tr>

  </table> </td>

  <td rowspan="3">

<img src="images/Successful-Submission-Content.gif" width="647" height="483" alt=""></td>

  <td>

<img src="file:///F|/PL Pelien Website/Composition/Pages/images/spacer.gif" width="1" height="242" alt=""></td>

</tr>

<tr>

<td>

<img src="images/Success_05.gif" width="153" height="240" alt=""></td>

  <td>

<img src="file:///F|/PL Pelien Website/Composition/Pages/images/spacer.gif" width="1" height="240" alt=""></td>

</tr>

<tr>

<td rowspan="2">

<img src="images/Bottom-Left.gif" width="153" height="169" alt=""></td>

<td>

<img src="file:///F|/PL Pelien Website/Composition/Pages/images/spacer.gif" width="1" height="1" alt=""></td>

</tr>

<tr>

<td>

<img src="images/Bottom-Center.gif" width="647" height="168" alt=""></td>

<td>

<img src="file:///F|/PL Pelien Website/Composition/Pages/images/spacer.gif" width="1" height="168" alt=""></td>

</tr>

</table>

<!-- End ImageReady Slices -->

</body>

</html>

EOD;

echo "$theResults";

 

?>

Link to comment
https://forums.phpfreaks.com/topic/140571-problem-with-form-handling-script/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.