2011-05-12 57 views
0

我之前发布了一个关于这个问题,但现在我有一个新问题,我没有得到。 下面是HTML:爆炸下拉值

<select name="contactname"> 
<option></option> 
<option value="John Smith|[email protected]">John Smith</option> 
</select> 

以下是错误现在,我感到我所做的投稿页面上进行更改。 解析错误:语法错误,上线48

这里意外T_CONSTANT_ENCAPSED_STRING是投稿页面:

</head> 
<body> 

<?php 

$pickone = $_POST [pickone]; 
$dropone = $_POST [dropone]; 
$weight = $_POST [weight]; 
$length = $_POST [length]; 
$pallets = $_POST [pallets]; 
$pickupdate = $_POST [pickupdate]; 
$equipment = $_POST [equipment]; 
$loadtype = $_POST [loadtype]; 
$specialinformation = $_POST [specialinformation]; 
$commodity = $_POST [commodity]; 
$closetime = $_POST [closetime]; 
$deliverydate = $_POST [deliverydate]; 
$req = $_POST [req]; 
$contact = explode('|', $_POST[contactname]); 


$header = "From: " . $contact[0] . " <" . $contact[1] . ">\r\n"; 
$subject= "New Load"; 
$from= "You"; 

$message = " 
Picks: $pickone 
Drops: $dropone \n 
    PU Date: $pickupdate  Close Time: $closetime 
Del Date: $deliverydate \n 
    Mode: $loadtype 
Equipment: $equipment 
    Length: $length 
    Weight: $weight 
    Pallets: $pallets 
Commodity: $commodity \n 

Requirements: 
$req \n 
Special Information: $specialinformation 
Contact: $contactname[0] 
"; 

mail("email.com", $subject, $message, $header"); 

?> 

<p align="center">Thank You<br> 
<input type="button" onclick="window.location.href='page.php';" value=" Post Another Load " /> 
</p> 

</body> 
</html> 

请让我知道我错过了,因为如果我不尝试爆炸CONTACTNAME它工作正常。谢谢,

+0

这行是第48? – 2011-05-12 23:06:02

+1

没有冒犯,但你的代码真的很糟糕。请将'error_reporting(E_ALL);'添加到代码的开头,然后修复所有通知。主要引用字符串(你的数组键) - 例如'$ _POST ['pickone']'而不是'$ _POST [pickone]' – ThiefMaster 2011-05-12 23:08:10

回答

0

不应该一行写着:

Contact: $contact[0] 
+0

是的,我只是解决了这个问题,我仍然得到相同的错误 – 2011-05-12 23:07:43

0

在邮件的最后,你有一个额外的双引号 mail("email.com", $subject, $message, $header"); 应该 mail("email.com", $subject, $message, $header);

1
mail("email.com", $subject, $message, $header"); 

删除该帖最后:

mail("email.com", $subject, $message, $header); 

另外你真的想插入一个真实的电子邮件地址,而不是“email.com”

虽然固定的东西,还引用您的所有数组键 - IE的$_POST['something']代替$_POST[something]和使用error_reporting(E_ALL);

+0

我明白...它编辑例如我的代码。就是这样!谢谢!!!!! – 2011-05-12 23:11:26

0

似乎有使启事在邮件行结尾处是错误的“。

尝试将其更改为:mail("email.com",$subject,$message,$header);

除此之外,我看不出有任何不妥的地方