运行此代码时出现以下错误:
解析错误:第 43 行 /Applications/XAMPP/...results.php 中的语法错误、意外的 ','、期待 ')'
第 43 行对应于下面的查询行。
这是我的代码。这些变量与来自问卷页面的表单输入相关。$source_of_fund_1
并且 $source_of_fund_1
与单选按钮表单输入有关。其他变量与文本字段/区域有关。我正在对单选按钮变量和!empty
文本字段/区域使用 isset 验证。
<?php
$source_of_fund_1 = $_POST['source_of_fund_1'];
$source_of_fund_2 = $_POST['source_of_fund_2'];
$repayment_date = $_POST['repayment_date'];
$do_differently = $_POST['do_differently'];
require_once 'connect.inc.php';
$query = "INSERT INTO tablename
(source_of_fund_1, source_of_fund_2, repayment_date, do_differently)
VALUES
('$source_of_fund_1', '$source_of_fund_2', '$repayment_date', '$do_differently')";
$result = @mysqli_query($link, $query);
if (($result) && !empty($repayment_date, $do_differently)
&& isset($source_of_fund_1, $source_of_fund_2)) {
echo 'Thank you for your submission.';
} else {
echo 'We were unable to process your information.'.mysqli_error($link).'Please ensure all required fields were filled out.';
}
mysqli_close($link);
?>
任何帮助将不胜感激!谢谢!