Join the campaign
{
$answer = $pqr_answers[$pqr_variable];
echo “
\n
\n
“;
}
}
# First of all the default is to show the form
$ccdb_ShowForm = “Yes”;
# Now get all the data – and, if appropriate, push it into the database
$ccdb_addlist = $_REQUEST[‘addlist’];
$ccdb_submitsupporter = $_REQUEST[‘submitsupporter’];
if(!empty($ccdb_addlist) or !empty($ccdb_submitsupporter)) {
if (!empty($ccdb_addlist)) {
$answers[’email’] = trim(strip_tags(stripslashes($_REQUEST[‘listemail’])));
$answers[‘mobile’] = trim(strip_tags(stripslashes($_REQUEST[‘listmobile’])));
$answers[‘getmail’] = $_REQUEST[‘listsendnews’];
if ($answers[’email’] == “Your email address”) {$answers[’email’]=””;}
if ($answers[‘mobile’] == “Your mobile number”) {$answers[‘mobile’]=””;}
$tempanswers = $answers;
if (!empty($answers[’email’]) or !empty($answers[‘mobile’])) {
unset($ccdb_joiner);
$ccdb_query = “INSERT INTO ccdb_supporters SET timestamp = now(),”;
foreach ($tempanswers as $ccdb_variable => $ccdb_result)
{
$ccdb_query .= $ccdb_joiner.”$ccdb_variable='”.addslashes($ccdb_result).”‘”;
$ccdb_joiner=”,”;
}
# echo $ccdb_query;
$ccdb_topmessage = “
Thank you for signing up to news. If you would like to pledge your support to Ming, please fill in the form below.
“;
$ccdb_result = mysql_query($ccdb_query);
}
} else {
$ccdb_helpofferresponse = $_REQUEST[‘helpoffer’];
unset($ccdb_helpofferstring);
if(!empty($ccdb_helpofferresponse)) {
foreach ($ccdb_helpofferresponse as $ccdb_helpnum => $ccdb_helpresponse) {
$ccdb_helpofferstring .= $ccdb_helpnum.”-“;
}
}
$ccdb_WantedVariables=array(“firstname”,”surname”,”email”,”mobile”,”homephone”,”address1″,”address2″,”address3″,”postcode”,”stateorregion”,”localparty”,”membership”,”getmail”);
empty($ccdb_joiner);
$ccdb_query = “INSERT INTO ccdb_supporters SET timestamp = now(), helpnumrecords=’$ccdb_helpofferstring’, “;
foreach ($ccdb_WantedVariables as $ccdb_variable)
{
$answers[$ccdb_variable] = trim(strip_tags(stripslashes($_REQUEST[$ccdb_variable])));
$ccdb_query .= $ccdb_joiner.”$ccdb_variable='”.addslashes($answers[$ccdb_variable]).”‘”;
$ccdb_joiner=”,”;
}
# echo $ccdb_query;
$ccdb_checkstring = $answers[’email’].$answers[‘mobile’].$answers[‘address1’].$answers[‘homephone’];
if (empty($ccdb_checkstring)) {
$ccdb_topmessage = “
Please can you provide some more information.
“;
} else {
$ccdb_topmessage = “
Thank you for registering your support.
“;
$ccdb_result = mysql_query($ccdb_query);
}
}
}
# if ($ccbd_ShowForm == “Yes”) {
/* Now display the form */
echo $ccdb_topmessage;
echo “
I support Ming Campbell’s campaign
“;
echo ‘
‘;
# }
?>