被隐藏的字段未出现在php脚本中

问题描述 投票:0回答:2

从PHP手册中:
php
2个回答
2
投票

('。=')是串联分配运算符,它在左侧的参数上附加了参数。

在您的脚本中,左侧的参数为空,它将生成一个e_notice,说

$message

变量不确定。
换句话说,

$message

变量在循环之外不存在,因此您将附加到不存在的变量附加。

this应该修复它:

$message = ""; //initialize it foreach($_POST['form_data'] as $item) { //Asigning the message fields to $message variable. $message .= $item; ... }


给出的代码正常工作,所有值都在$ _ post中填充。 检查一下,让我们知道结果

array(3) { ["email_address"]=> string(22) "[email protected]" ["email_subject"]=> string(11) "Hello World" ["form_data"]=> array(3) { [0]=> string(5) "dwdcw" [1]=> string(2) "fw" [2]=> string(3) "dfw" } }
    

1
投票
最新问题
© www.soinside.com 2019 - 2025. All rights reserved.