NVM 我现在已经想通了,原来我只是完全智障......
我一直在查看此 ValidForm Builder 的教程。我似乎找不到任何地方解释如何仅获取纯提交的数据。我不在乎数据是否存储在数组中,因为它们可以被操纵。我唯一能看到的是,当提交表单时,它会将数据存储在某种形式的电子邮件友好 html 代码中。
$objForm = new ValidForm("newsletterForm", "");
$objForm->addField("name", "Your name", VFORM_STRING,
array(
"maxLength" => 255,
"required" => TRUE
),
array(
"maxLength" => "Your input is too long. A maximum of %s characters is OK.",
"required" => "This field is required.",
"type" => "Enter only letters and spaces."
)
);
$objForm->addField("email", "Email address", VFORM_EMAIL,
array(
"maxLength" => 255,
"required" => TRUE
),
array(
"maxLength" => "Your input is too long. A maximum of %s characters is OK.",
"required" => "This field is required.",
"type" => "Use the format name@domain.com"
), array(
"tip" => "name@domain.com"
)
);
$objForm->setMainAlert("One or more errors occurred. Check the marked fields and try again.");
$objForm->setSubmitLabel("Send");
$strOutput = "";
if ($objForm->isSubmitted() && $objForm->isValid()) {
//Do something php here if the form is sumbitted correct
//*** Set the output to a friendly thank you note.
$strOutput = "Thank you for your interest.";
} else {
//*** The form has not been submitted or is not valid.
$strOutput = $objForm->toHtml();
}
基本上我只需要原始数据,这样我就可以将它存储到我的数据库中......