• VadimG

    (@vadimg)


    Hello!

    I have a problem inserting this PHP code:

    <?PHP
    	// --- - -------- -- -------- ----- ----
    	// B2B - BUSINESS TO BUSINESS ORDER FORM
    	// w/ automatic delimited file form fill
    	// w/ automatic s/h & total calculations
    	// --- - -------- -- -------- ----- ----
    	// If you're a vendor providing this form for your business customers to use,
    	//    some preset variables should most likely be empty ("").
    	// If you're a business customer using this to send e-mail orders to your vendor,
    	//    you can save typing by filling in most of the following preset variables.
    	// --- - -------- -- -------- ----- ----
    	// ABOUT THE AUTHOR
    	// Keith D Commiskey (c)2006
    	// http://kdcinfo.com - Web Development, Database Development, 3D Graphics and Computer Animation
    	// http://giftsforyou.biz - Collectible Crystal Figurines and other affordable gifts
    	// --- - -------- -- -------- ----- ----
    
    	$STN = "Matrix Imports - E-mail Order Form - <i>You will recieve a confirmation e-mail and<br />an e-mail with your total cost shortly after.</i>";	// Vendor: Use space-hyphen-space for line breaks
    	$CNv = "My Company, Inc.";					// Reseller's company name (default value on form)
    												// First 15 characters will be on e-mail subject line
    
    	$MailFr = "email@email.com";				// Your e-mail address (Trial Run and CC on Good Run)
    	$MailTo = "parts@matriximportsusa.com";				// Vendor's e-mail address (Good Run)
    
    	$Say1t = "Standard";					// Shipping Method 1 - Form view
    	$Say1c = "";							// Shipping Method 1 - Comments
    	$Say2t = "Rush";						// Shipping Method 2 - Form view
    	$Say2c = "Please OVERNIGHT";			// Shipping Method 2 - Comments
    
    	$SalesTax = "0.875";					// Sales tax - use format: 0.xxx (NOT IMPLEMENTED YET)
    	$ShipMultiple = "2.00";					// Shipping for items if more than 1; first is full shipping
    												// Make empty quotes "" to keep actual shipping.
    
    	$Pay1t = "COD";						// Payment Option 1 - Form view
    	$Pay1c = "Cash on Delivery";				// Payment Option 1 - Comments (e.g., E-mail)
    	$Pay2t = "CC on File";					// Payment Option 2 - Form view
    	$Pay2c = "Last Four: 1234";				// Payment Option 2 - Comments (e.g., E-mail)
    	$Pay3t = "Net 30";					// Payment Option 2 - Form view
    	$Pay3c = "Apply for Net 30";				// Payment Option 2 - Comments (e.g., E-mail)
    
    	$Xtra1t = "Option<br />1";					// Extra Option 1 - leave empty quotes "" for none
    	$Xtra1c = "2.50";						// Cost - decimal only (numbers & decimal only)
    	$Xtra2t = "Option<br />2";					// Extra Option 2 - leave empty quotes "" for none
    	$Xtra2c = "5.00";						// Cost - decimal only (numbers & decimal only)
    
    	$Handling = "0.00";						// Vendor handling fee - Make 0.00 for none
    
    	$UNSure = "(Please update costs: There is no set formula for Rush shipping.)";
    			  // e.g., If you'd like shipping calculations to be validated by vendor
    
    	$FormTitleNote = "*You can either submit your order through this page or print and fax it to: <strong>(954) 970-0289</strong><br>";
    	$FormTitleNote .= "*We accept checks and major credit cards.";
    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    	<title><? echo $STN; ?></title>
    	<meta name="description" content="B2B Order Form - (Business-to-Business Order Form) by Keith D Commiskey">
    	<meta name="keywords" content="order form, b2b order form, business-to-business order form, b2b web development, b2b e-commerce, b2b needs, purchase order form, order form template">
    	<script language="JavaScript" src="cf.js" type="text/javascript"> </script>
    	<script language="JavaScript" type="text/javascript">
    		function sepIt (CObj,CObjInt,HowMany)
    		{	with (document.postit)
    			{	var CObjSplit
    				CObjSplit = CObj[CObj.selectedIndex].value.split("|");
    				eval('F'+CObjInt+'a').value = CObjSplit[0];
    				eval('F'+CObjInt+'c').value = (CObjSplit[1]*1).toFixed(2);
    				if (CObjInt>1)
    						<? if ($ShipMultiple!="") { ?>
    						{	eval('F'+CObjInt+'d').value = (<? echo $ShipMultiple; ?>*1).toFixed(2);}
    						<? } else { ?>
    						{	eval('F'+CObjInt+'d').value = (CObjSplit[2]*1).toFixed(2);}
    						<? } ?>
    				else	{	eval('F'+CObjInt+'d').value = (CObjSplit[2]*1).toFixed(2);}
    				eval('F'+CObjInt+'b').value = CObjSplit[3];
    				// item #|cost|shipping|item name
    				putTotal(HowMany);
    			}
    		}
    		function putTotal (HowMany)
    		{	var FValc, FVald, i
    			FValc = 0;	// Total Cost
    			FVald = 0;	// Shipping Cost
    			for (i=1; i<=HowMany.value; i++)
    			{	with (document.postit)
    				{
    					FVald = FVald+(eval('F'+i+'d').value*1);
    					FValc = FValc+((eval('F'+i+'c').value*1)*(eval('F'+i+'q').value*1))+(eval('F'+i+'d').value*1);
    					if (eval('F'+i+'x').checked == true)
    					{	FValc = FValc+(eval('F'+i+'x').value*1);	}
    					if (eval('F'+i+'y').checked == true)
    					{	FValc = FValc+(eval('F'+i+'y').value*1);	}
    			}	}
    			if (FVald < 2)
    					{ document.postit.SC.value = FVald.toFixed(2); }
    			else	{ document.postit.SC.value = (FVald+1).toFixed(2); }
    			document.postit.TC.value = (FValc+<? echo $Handling; ?>).toFixed(2);
    		}
    		function intThis (decIt)
    		{	decIt.value = (decIt.value*1).toFixed(2);	}
    		function intThis0 (decIt)
    		{	if (decIt.value!="")
    			{	decIt.value = (decIt.value*1).toFixed(0);	}
    		}
    	</script>
    	<style type="text/css">
    	<!--
    		BODY	{	font-family: arial, verdana, helvetica, sans-serif; font-size: small; color: Navy; }
    		P		{	font-family: arial, verdana, helvetica, sans-serif; font-size: small; color: Navy; }
    		TD		{	font-family: arial, verdana, helvetica, sans-serif; font-size: x-small; color: Navy; }
    		A			{	color: #0000FF; text-decoration: none; }
    		A:visited	{	color: #3344FF; text-decoration: none; }
    		A:hover		{	color: #CC0033; text-decoration : underline; background-color:#E6E9FE; }
    		H1		{	font-family: arial, verdana, helvetica, sans-serif; font-size: large; color: Navy; font-weight : bold; margin-top : 0; margin-bottom : 0; margin : 0px 0px 0px 0px; }
    		H2		{	font-family: arial, verdana, helvetica, sans-serif; font-size: small; color: Navy; font-weight : bold; margin-top : 0; margin-bottom : 0; margin : 0px 0px 0px 0px; }
    		H3		{	font-family: arial, verdana, helvetica, sans-serif; font-size: small; color: Maroon; font-weight : bold; margin-top : 0; margin-bottom : 0; margin : 0px 0px 5px 0px; }
    	//-->
    	</style>
    </head>
    <?
    if (!isset($_POST['NewWin']))
    		{	echo "<body onload=\"document.postit.SID.focus();\">";	}
    else	{	echo "<body>";	}
    
    if ((!isset($_POST['HowMany']))||((isset($_POST['HowMany']))&&($_POST['HowMany']=='')))
    {	$HowMany = 5;	}
    else
    {	$HowMany = $_POST['HowMany'];
    	if ((isset($_POST['SendItGood']))&&($_POST['SendItGood']=="1")&&($_POST['DT']==""))
    	{	$GoodToGo = "Delivery address was empty...";	}
    	else if ((isset($_POST['SendItGood']))&&($_POST['SendItGood']=="1"))
    	{	$GoodToGo = "Mailing...&nbsp;";
    		$bName1 = $MailTo; // Active Address (good run)
    		$bNameP = $_POST['EID']; // Return Path
    		$bNameR = $_POST['EID']; // Return Receipt To
    		$bNameF = $_POST['EID']; // From Address
    		$bNameE = $_POST['EID']; // Return Errors To
    		$bName2 = $_POST['EID']; // Test Address (trial run) and CC (good run)
    		$rsMailSubjectC = "";
    		$rsSubtotal = 0;
    		for ($iq = 1; $iq <= $HowMany; $iq++)
    		{	$rsMailSubjectC .= $_POST['F'.$iq.'a'] . ",";	}
    		$rsMailSubjectC = substr($rsMailSubjectC, 0, strlen($rsMailSubjectC)-1);
    
    			for ($ib = 1; $ib <= $HowMany; $ib++)
    			{	$rsMailBody .= "[Q:".$_POST['F'.$ib.'q']."] [".$_POST['F'.$ib.'a']."] \n";
    				$rsMailBody .= "\t".$_POST['F'.$ib.'b']."\n";
    				if ($_POST['F'.$ib.'x']!="") { $rsMailBody .= "\t".$Xtra1t." - $".$Xtra1c."\n"; }
    				if ($_POST['F'.$ib.'y']!="") { $rsMailBody .= "\t".$Xtra2t." - $".$Xtra2c."\n"; }
    				if ($_POST['TAG'.$ib.'g']!="") { $rsMailBody .= "\t[TAG: ".$_POST['TAG'.$ib.'g']."]\n"; }
    			}
    			$rsMailBody.="\n";
    			$rsMailBody .= "DELIVER TO:\n";
    			$rsMailBody .= str_replace("\r\n", "\n", $_POST['DT'])."\n\n";
    			$rsMailBody .= "MESSAGE:\n";
    			if ($_POST['Msg']==""){$rsMailBody .= "\n";}else{$rsMailBody .= $_POST['Msg']."\n\n";}
    			$rsMailBody .= "COMMENTS:\n";
    			if ($_POST['CMsg']==""){$rsMailBody .= "\n";}else{$rsMailBody .= $_POST['CMsg']."\n\n";}
    			$rsMailBody .= "SHIPPING / PAYMENT:\n";
    			if ($_POST['SMc']=="")
    					{	$rsMailBody .= $_POST['SM']."\n";	}
    			else	{	$rsMailBody .= $_POST['SM']." (".$_POST['SMc'].")\n";	}
    			if ($_POST['PMc']=="")
    					{	$rsMailBody .= $_POST['PM']."\n";	}
    			else	{	$rsMailBody .= $_POST['PM']." (".$_POST['PMc'].")\n";	}
    
    			$rsMailBody .= "\nThanks!\n--\n".$_POST['CN'];
    
    		$mail = new mime_mail();
    		$mail->from = $bNameF;
    		if (isset($_POST['TestSend']))
    				{	$mail->to = $bName2; $GoodToGo .= "(Trial Run)...";	}
    		else	{	$mail->to = $bName1; $mail->cc = $bName2; $GoodToGo .= "(Good Run)...";	}
    		if ($_POST['SM']=="Standard")
    				{	if ($_POST['SID']=="")
    							{	$rsMailSubj = "Web Order- ".substr($_POST['CN'], 0, 15)." (".$rsMailSubjectC.")";	}
    					else	{	$rsMailSubj = "Web Order- ".substr($_POST['CN'], 0, 15)."- ".$_POST['SID']." (".$rsMailSubjectC.")";	}
    				}
    		else	{	if ($_POST['SID']=="")
    							{	$rsMailSubj = "Web Order- ".substr($_POST['CN'], 0, 15)."- RUSH (".$rsMailSubjectC.")";	}
    					else	{	$rsMailSubj = "Web Order- ".substr($_POST['CN'], 0, 15)."- RUSH- ".$_POST['SID']." (".$rsMailSubjectC.")";	}
    				}
    		$mail->subject = $rsMailSubj;
    		$mail->body = $rsMailBody;
    		$mail->path = $bNameP;
    		$mail->receipt = $bNameR;
    		$mail->errors = $bNameE;
    		$mail->headers = "text/plain; charset=utf-7"; // correct - ¾ is ¾
    		$mail->send($rsMailBody);
    		$GoodToGo .= "&nbsp;Mail has been sent!<br><br>";
    }	}
    ?>
    <table align="center" cellspacing="0" cellpadding="0" border="0" width="700" style="font-family:Arial;font-size:10pt">
    <?	if (isset($GoodToGo))
    	{	echo "<tr><td align=\"center\" colspan=\"3\"><H2 style=\"color:Maroon;\">$GoodToGo</H2></td></tr>";
    		echo "<tr><td colspan=\"3\" style=\"height:1px;font-size:xx-small;\" height=\"1\" bgcolor=\"#FFFFFF\"><hr width=\"100%\" size=\"1\" color=\"#800000\" noshade></td></tr>";	}
    ?>
    	<tr><td align="center" colspan="3">
    		<H1><? echo str_replace(" - ", "<br>", $STN); ?></H1>
    			<? if (!isset($_POST['NewWin'])) { if ($FormTitleNote!="") { echo $FormTitleNote; } } ?>
    			<? if (!isset($_POST['NewWin'])) { ?>
    			<br>
    			<? } ?>
    
    	</td></tr>
    <?	if (isset($_POST['NewWin']))
    	{	echo "<tr><td align=\"left\" colspan=\"3\" style=\"color:Maroon;\"><P>&nbsp;</P>";
    		if ((isset($_POST['SendItGood']))&&($_POST['SendItGood']=="1")&&($_POST['DT']==""))
    		{	echo "<P><strong>Delivery address was empty, therefore, mail was NOT sent.</strong><br><br>Please <a HREF=\"javascript:self.close();\">close this window</a> to return to your order form.</P><br>";	}
    		else
    		{	if (isset($_POST['TestSend']))
    					{	echo "<P><strong>Sent TO</strong>: ".$bName2."</P>";	}
    			else	{	echo "<P><strong>Sent TO</strong>: ".$bName1."<br><strong>Sent CC</strong>: ".$bName2."</P>";	}
    			echo "<P><strong>Mail has been sent.</strong> Please <a HREF=\"javascript:self.close();\">close this window</a> to return to your order form.</P><br>";
    			echo "<div align=\"left\"><pre style=\"font-size:small;\"><strong>SUBJECT</strong>: ".$rsMailSubj."<br><br>\n\n";
    			echo $rsMailBody."</pre></div><br><br>";
    		}
    		echo "</td></tr></table>";
    		exit();
    	}
    ?>
    	<tr><td colspan="3" style="height:1px;font-size:xx-small;" height="1" bgcolor="#FFFFFF"><hr width="100%" size="1" color="#800000" noshade></td></tr>
    	<form action="<? echo $_SERVER['PHP_SELF']; ?>" method="post" name="postit" id="postit" target="_self">
    <?PHP
    	echo "<tr bgcolor=\"#DDEEFF\"><td align=\"right\"></td><td>&nbsp;</td><td>";
    		if (isset($_POST['SID']))
    				{	echo "";	}
    		else	{	echo "<input type=\"text\" name=\"SID\" id=\"SID\" size=\"15\" value=\"\" style=\"display:none\">";	}
    		echo "&nbsp;</td></tr>";
    	echo "<tr bgcolor=\"#DDEEFF\"><td align=\"right\"><strong>E-mail Address</strong></td><td>&nbsp;</td><td>";
    		if (isset($_POST['EID']))
    				{	echo "<input type=\"text\" name=\"EID\" id=\"EID\" size=\"35\" value=\"".$_POST['EID']."\">";	}
    		else	{	echo "<input type=\"text\" name=\"EID\" id=\"EID\" size=\"35\" value=\"$MailFr\">";	}
    		echo "&nbsp;Your e-mail address</td></tr>";
    	echo "<tr bgcolor=\"#DDEEFF\"><td align=\"right\"><strong>Company Name</strong></td><td>&nbsp;</td><td>";
    		if (isset($_POST['CN']))
    				{	echo "<input type=\"text\" name=\"CN\" id=\"CN\" size=\"35\" value=\"".$_POST['CN']."\">";	}
    		else	{	echo "<input type=\"text\" name=\"CN\" id=\"CN\" size=\"35\" value=\"$CNv\">";	}
    		echo "&nbsp;Your company name<br />
    		</td></tr>";
    ?>
    
    			<tr>
    				<td align="left" valign="top" colspan="3">How Many Different Products are you ordering?<br /></td></tr><tr>
    				<td width="100" valign="top" colspan="3"><input type="Text" name="HowMany" id="HowMany" value="<? echo $HowMany; ?>" size="2">&nbsp;&nbsp;<button type="submit" name="Reset2" id="Reset2" onclick="SendItGood.value='0';NewWin.checked=false;document.postit.target='_self';">Update</button></td>
    			</tr>
    			<tr>
    				<td colspan="3" valign="top"><strong>Note:</strong> Any item entries will be reset</td>
    			</tr>
    
    	<tr><td colspan="3" style="height:1px;font-size:xx-small;" height="1" bgcolor="#FFFFFF"><hr width="100%" size="1" color="#800000" noshade></td></tr>
    	<tr><td align="right">&nbsp;</td><td>&nbsp;</td><td>
    		<table border="0" width="100%" cellspacing="0" cellpadding="0" style="font-family:Arial;font-size:10pt"><tr>
    			<td width="138">Item #</td>
    			<td width="72" align="center">Qty</td>
    			<td width="223" align="center">Item Name</td>
    			<td width="123" align="center">TAG#</td>
    			<td width="85" align="center">&nbsp;</td>
    
    		</tr></table>
    	</td></tr>
    <?PHP
    	for ($iT = 1; $iT <= $HowMany; $iT++)
    	{	echo "<tr><td align=\"right\"><strong>Item {$iT}</strong></td><td>&nbsp;</td><td>\n";
    		echo "\t<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"0\" style=\"font-family:Arial;font-size:10pt\"><tr>\n";
    			echo "\t<input type=\"hidden\" name=\"F{$iT}a\" id=\"F{$iT}a\">\n";
    			echo "\t<td width=\"100\">\n";
    				echo "\t\t<select name=\"DisperseIt{$iT}\" id=\"DisperseIt{$iT}\" size=\"1\" onchange=\"sepIt(this,$iT,document.postit.HowMany);\">\n";
    				echo "\t\t<option value=\"\" SELECTED>Item #</option>\n";
    				$handle = fopen("b2b_text.txt", "r");
    				while (($data = fgetcsv($handle, 1024, "|")) !== FALSE)
    				{	echo "\t\t<option value=\"".$data[0]."|".$data[2]."|".$data[3]."|".$data[1]."|\">".$data[0]."</option>\n";	}
    				fclose($handle);
    				echo "\t\t</select>\n\t</td>\n";
    			echo "\t<td width=\"40\"><input type=\"text\" name=\"F{$iT}q\" id=\"F{$iT}q\" size=\"2\" value=\"1\" onblur=\"intThis0(this);putTotal(document.postit.HowMany);\"></td>\n";
    			echo "\t<td><input type=\"text\" name=\"F{$iT}b\" id=\"F{$iT}b\" size=\"33\"></td>\n";
    			echo "\t<td width=\"60\">\n";
    			echo "\t<input type=\"text\" name=\"TAG{$iT}g\" id=\"TAG\" size=\"20\" value=\"".$_POST['TAG']."\">\n";
    			echo "\t<input type=\"text\" name=\"F{$iT}c\" id=\"F{$iT}c\" size=\"5\" onblur=\"intThis(this);putTotal(document.postit.HowMany);\" style=\"display:none\"></td>\n";
    			echo "\t<td width=\"60\"><input type=\"text\" name=\"F{$iT}d\" id=\"F{$iT}d\" size=\"5\" onblur=\"intThis(this);putTotal(document.postit.HowMany);\" style=\"display:none\"></td>\n";
    
    		echo "\t</tr></table>\n";
    		echo "</td></tr>\n\n";
    	}
    ?>
    
    	<tr><td colspan="3" style="height:9px;font-size:xx-small;" height="9" bgcolor="#FFFFFF"><hr width="100%" size="1" color="#FFFFFF" noshade></td></tr>
    <?PHP
    	echo "<tr><td align=\"right\">Shipping Method</td><td>&nbsp;</td><td>";
    		echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"font-family:Arial;font-size:10pt\"><tr>";
    		if ((isset($_POST['SM']) && $_POST['SM']==$Say2t))
    		{	echo "<td width=\"10\"><input type=\"radio\" name=\"SM\" value=\"$Say1t\" onClick=\"SMc.value='$Say1c';\"></td><td width=\"100\">$Say1t</td>";
    			echo "<td width=\"10\"><input type=\"radio\" name=\"SM\" value=\"$Say2t\" checked onClick=\"SMc.value='$Say2c';\"></td><td width=\"100\">$Say2t</td>";
    			echo "<td width=\"10\"></td><td width=\"100\"></td>";
    		}
    		else
    		{	echo "<td width=\"10\"><input type=\"radio\" name=\"SM\" value=\"$Say1t\" checked onClick=\"SMc.value='$Say1c';\"></td><td width=\"100\">$Say1t</td>";
    			echo "<td width=\"25\"><input type=\"radio\" name=\"SM\" value=\"$Say2t\" onClick=\"SMc.value='$Say2c';\"></td><td width=\"100\">$Say2t</td>";
    			echo "<td width=\"15\"></td><td width=\"100\"></td>";
    		}
    		if (isset($_POST['SMc']))
    				{	echo "<td><input type=\"text\" size=\"25\" name=\"SMc\" id=\"SMc\" value=\"".$_POST['SMc']."\"></td></tr></table></td></tr>";	}
    		else	{	echo "<td><input type=\"text\" size=\"25\" name=\"SMc\" id=\"SMc\" value=\"$Say1c\"></td></tr></table></td></tr>";	}
    
    	echo "<tr><td align=\"right\">Payment Method</td><td>&nbsp;</td><td>";
    		echo "<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\" style=\"font-family:Arial;font-size:10pt\"><tr>";
    		if ((isset($_POST['PM']) && $_POST['PM']==$Pay2t))
    		{	echo "<td width=\"10\"><input type=\"radio\" name=\"PM\" value=\"$Pay1t\" onClick=\"PMc.value='$Pay1c';\"></td><td width=\"100\">$Pay1t</td>";
    			echo "<td width=\"10\"><input type=\"radio\" name=\"PM\" value=\"$Pay2t\" checked onClick=\"PMc.value='$Pay2c';\"></td><td width=\"100\">$Pay2t</td>";
    			echo "<td width=\"10\"><input type=\"radio\" name=\"PM\" value=\"$Pay3t\" checked onClick=\"PMc.value='$Pay3c';\"></td><td width=\"100\">$Pay2t</td>";
    		}
    		else
    		{	echo "<td width=\"10\"><input type=\"radio\" name=\"PM\" value=\"$Pay1t\" checked onClick=\"PMc.value='$Pay1c';\"></td><td width=\"100\">$Pay1t</td>";
    			echo "<td width=\"10\"><input type=\"radio\" name=\"PM\" value=\"$Pay2t\" onClick=\"PMc.value='$Pay2c';\"></td><td width=\"100\">$Pay2t</td>";
    			echo "<td width=\"10\"><input type=\"radio\" name=\"PM\" value=\"$Pay3t\" onClick=\"PMc.value='$Pay3c';\"></td><td width=\"100\">$Pay3t</td>";
    		}
    
    		if (isset($_POST['PMc']))
    				{	echo "<td><input type=\"text\" size=\"25\" name=\"PMc\" id=\"PMc\" value=\"".$_POST['PMc']."\"></td></tr></table></td></tr>";	}
    		else	{	echo "<td><input type=\"text\" size=\"25\" name=\"PMc\" id=\"PMc\" value=\"$Pay1c\"></td></tr></table></td></tr>";	}
    ?>
    	<tr><td colspan="3" style="height:1px;font-size:xx-small;" height="1" bgcolor="#FFFFFF"><hr width="100%" size="1" color="#800000" noshade></td></tr>
    <?PHP
    	echo "<tr bgcolor=\"#DDEEFF\"><td align=\"right\"><strong>Deliver To</strong></td><td>&nbsp;</td><td>";
    		if (isset($_POST['DT']))
    				{	echo "<textarea cols=\"60\" rows=\"5\" name=\"DT\" id=\"DT\">".$_POST['DT']."</textarea>";	}
    		else	{	echo "<textarea cols=\"60\" rows=\"5\" name=\"DT\" id=\"DT\"></textarea>";	}
    	echo "</td></tr>";
    	echo "<tr><td align=\"right\">Message from<br>end customer</td><td>&nbsp;</td><td>";
    		if (isset($_POST['Msg']))
    				{	echo "<textarea cols=\"60\" rows=\"3\" name=\"Msg\" id=\"Msg\">".$_POST['Msg']."</textarea>";	}
    		else	{	echo "<textarea cols=\"60\" rows=\"3\" name=\"Msg\" id=\"Msg\"></textarea>";	}
    	echo "</td></tr>";
    	echo "<tr><td align=\"right\">Comments<br>from reseller</td><td>&nbsp;</td><td>";
    		if (isset($_POST['CMsg']))
    				{	echo "<textarea cols=\"60\" rows=\"3\" name=\"CMsg\" id=\"CMsg\">".$_POST['CMsg']."</textarea>";	}
    		else	{	echo "<textarea cols=\"60\" rows=\"3\" name=\"CMsg\" id=\"CMsg\"></textarea>";	}
    	echo "</td></tr>";
    ?>
    	<tr><td colspan="3" style="height:1px;font-size:xx-small;" height="1" bgcolor="#FFFFFF"><hr width="100%" size="1" color="#800000" noshade></td></tr>
    	<tr><td align="right">
    		<button type="submit" name="Action" id="Action" onClick="if(document.postit.TestSend.checked==true){document.postit.NewWin.checked=true;document.postit.target='_blank';}">Send It !</button></td><td>&nbsp;</td>
    		<td>
    			<table border="0" cellspacing="0" cellpadding="0" style="font-family:Arial;font-size:10pt">
    				<tr>
    					<td>&nbsp;&nbsp;</td>
    				</tr><tr>
    					<td>&nbsp;&nbsp;</td>
    				</tr>
    			</table>
    		</td></tr>
    	<tr><td colspan="3" style="height:1px;font-size:xx-small;" height="1" bgcolor="#FFFFFF"><hr width="100%" size="1" color="#800000" noshade></td></tr>
    	<tr><td colspan="2">&nbsp;</td><td align="right">
    
    	</td></tr>
    	<input type="hidden" name="SendItGood" value="1">
    	</form>
    </table>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" align="right">
    	<tr><td><hr color="Maroon" size="1"></td></tr>
    	<tr><td align="right">
    
    	</td></tr>
    </table>
    <?PHP
    	class mime_mail
    	{	var $from; var $to; var $cc; var $bcc; var $receipt; var $path;
    		var $subject; var $body; var $errors; var $headers;
    		function mime_mail()
    		{	$this->from = "";
    			$this->to = "";
    			$this->subject = "";
    			$this->body = "";
    			$this->errors = "";
    			$this->cc = "";
    			$this->bcc = "";
    			$this->headers = "";
    			$this->path = "";
    			$this->receipt = "";
    		}
    		function send()
    		{	$mime = "";
    			if (!empty($this->from))
    				$mime .= "From: ".$this->from . "\n";
    			if (!empty($this->errors))
    				$mime .= "Errors-To: ".$this->errors . "\n";
    			if (!empty($this->cc))
    				$mime .= "CC: ".$this->cc . "\n";
    			if (!empty($this->bcc))
    				$mime .= "BCC: ".$this->bcc . "\n";
    			if (!empty($this->headers))
    				$mime .= "Content-type: ".$this->headers . "\n";
    			if (!empty($this->path))
    				$mime .= "Return-Path: ".$this->path . "\n";
    			if (!empty($this->receipt))
    				$mime .= "Return-Receipt-To: ".$this->receipt . "\n";
    			mail($this->to, $this->subject, stripslashes($this->body), $mime);
    	}	};
    ?>
    <?PHP
    //	--------
    //	_ 1.11 _
    //	--------
    //	* Added validation: Delivery address cannot be empty
    //	* Both "extras" will be added as line items to order e-mail (if selected)
    //	--------
    //	_ 1.10 _
    //	--------
    //	* Added option to limit multiple quantity shipping costs, or keep per item shipping (checkbox and textbox might be nice)
    //	* Added quantity to individual (itemized) item costs in e-mail
    //	* Added Subtotal under (itemized) item list in e-mail
    //	* Ready to add sales tax option (variable established) - need checkbox and textbox
    ?>

    to one of my page. Please,can you help me with that?

    Thanks a lot!

    https://wordpress.org/plugins/insert-php/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author WillBontrager

    (@willbontrager)

    VadimG, Insert PHP will run only valid PHP code with the <?php and ?> replaced with the Insert PHP placeholders. The code you provided has HTML mixed in with it.

    Because Insert PHP runs the PHP code with the eval() function, all related PHP code needs to be together. The code you provided has PHP code in several places. More information about not separating the code for use within Inert PHP is here:
    http://www.willmaster.com/software/WPplugins/insert-php-wordpress-plugin-instructions.php#inandofitself

    Will
    P.S. Suggest editing the code you posted to obfuscate any live email addresses.

    Thread Starter VadimG

    (@vadimg)

    Oh…its a nightmare for me. I am not from this field. My boss just asked me to help him to add this code to one of our pages. I don’t know what to do…

    So, as I understand this plugin won’t work, right?

    Or, what I should do?

    Thank you for your help!

    Plugin Author WillBontrager

    (@willbontrager)

    Probably it would be prudent to consult with someone who is competent with both PHP and WordPress.

    Will

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘I need help with PHP’ is closed to new replies.