I'm getting the following error when I run this code:
Parse error: syntax error, unexpected ',', expecting ')' in /Applications/XAMPP/...results.php on line 43
Line 43 corresponds to the query line below.
Here is my code. The variables are related to form inputs from a questionnaire page. $source_of_fund_1
and $source_of_fund_1
are related to radio button form inputs. The other variables are related to text fields/areas. I'm using validation of isset for the radio button variables and !empty
for the text field/areas.
<?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);
?>
Any help at all would be much appreciated! Thank you!