{"id":9,"date":"2006-01-12T19:08:38","date_gmt":"2006-01-12T18:08:38","guid":{"rendered":"http:\/\/s143831080.websitehome.co.uk\/mc\/support-the-campaign\/"},"modified":"2006-01-15T19:26:25","modified_gmt":"2006-01-15T19:26:25","slug":"support-the-campaign","status":"publish","type":"page","link":"http:\/\/www.mingcampbell.org.uk\/ccarchive\/support-the-campaign\/","title":{"rendered":"Join the campaign"},"content":{"rendered":"<phpcode>\n<?php\n\/* Do not touch any of the following section unless you really know what you are doing *\/\n# print_r($_REQUEST);\nfunction putquestionsinrows($pqr_questions,$pqr_answers) {\n\tforeach ($pqr_questions as $pqr_variable => $pqr_description)<br \/>\n\t{<br \/>\n\t\t$answer = $pqr_answers[$pqr_variable];<br \/>\n\t\techo &#8220;<\/p>\n<tr>\\n<\/p>\n<td>$pqr_description<\/td>\n<p>\\n<\/p>\n<td><input type=\\\"text\\\" name=\\\"$pqr_variable\\\" value=\\\"$answer\\\"\/><\/td>\n<p>\\n<\/tr>\n<p>&#8220;;<br \/>\n\t}<br \/>\n}<br \/>\n# First of all the default is to show the form<br \/>\n$ccdb_ShowForm = &#8220;Yes&#8221;;<br \/>\n# Now get all the data &#8211; and, if appropriate, push it into the database<br \/>\n$ccdb_addlist = $_REQUEST[&#8216;addlist&#8217;];<br \/>\n$ccdb_submitsupporter = $_REQUEST[&#8216;submitsupporter&#8217;];<br \/>\nif(!empty($ccdb_addlist) or !empty($ccdb_submitsupporter)) {<br \/>\n\tif (!empty($ccdb_addlist)) {<br \/>\n\t\t$answers[&#8217;email&#8217;] = trim(strip_tags(stripslashes($_REQUEST[&#8216;listemail&#8217;])));<br \/>\n\t\t$answers[&#8216;mobile&#8217;] = trim(strip_tags(stripslashes($_REQUEST[&#8216;listmobile&#8217;])));<br \/>\n\t\t$answers[&#8216;getmail&#8217;] = $_REQUEST[&#8216;listsendnews&#8217;];<br \/>\n\t\tif ($answers[&#8217;email&#8217;] == &#8220;Your email address&#8221;) {$answers[&#8217;email&#8217;]=&#8221;&#8221;;}<br \/>\n\t\tif ($answers[&#8216;mobile&#8217;] == &#8220;Your mobile number&#8221;) {$answers[&#8216;mobile&#8217;]=&#8221;&#8221;;}<br \/>\n\t\t$tempanswers = $answers;<br \/>\n\t\tif (!empty($answers[&#8217;email&#8217;]) or !empty($answers[&#8216;mobile&#8217;])) {<br \/>\n\t\t\tunset($ccdb_joiner);<br \/>\n\t\t\t$ccdb_query = &#8220;INSERT INTO ccdb_supporters SET timestamp = now(),&#8221;;<br \/>\n\t\t\tforeach ($tempanswers as $ccdb_variable => $ccdb_result)<br \/>\n\t\t\t{<br \/>\n\t\t\t\t$ccdb_query .= $ccdb_joiner.&#8221;$ccdb_variable='&#8221;.addslashes($ccdb_result).&#8221;&#8216;&#8221;;<br \/>\n\t\t\t\t$ccdb_joiner=&#8221;,&#8221;;<br \/>\n\t\t\t}<br \/>\n\t\t\t# echo $ccdb_query;<br \/>\n\t\t\t$ccdb_topmessage = &#8220;<\/p>\n<p>Thank you for signing up to news. If you would like to pledge your support to Ming, please fill in the form below.<\/p>\n<p>&#8220;;<br \/>\n\t\t\t$ccdb_result = mysql_query($ccdb_query);<br \/>\n\t\t}<br \/>\n\t} else {<br \/>\n\t\t$ccdb_helpofferresponse = $_REQUEST[&#8216;helpoffer&#8217;];<br \/>\n\t\tunset($ccdb_helpofferstring);<br \/>\n\t\tif(!empty($ccdb_helpofferresponse)) {<br \/>\n\t\t\tforeach ($ccdb_helpofferresponse as $ccdb_helpnum => $ccdb_helpresponse) {<br \/>\n\t\t\t\t$ccdb_helpofferstring .= $ccdb_helpnum.&#8221;-&#8220;;<br \/>\n\t\t\t}<br \/>\n\t\t}<br \/>\n\t\t$ccdb_WantedVariables=array(&#8220;firstname&#8221;,&#8221;surname&#8221;,&#8221;email&#8221;,&#8221;mobile&#8221;,&#8221;homephone&#8221;,&#8221;address1&#8243;,&#8221;address2&#8243;,&#8221;address3&#8243;,&#8221;postcode&#8221;,&#8221;stateorregion&#8221;,&#8221;localparty&#8221;,&#8221;membership&#8221;,&#8221;getmail&#8221;);<br \/>\n\t\tempty($ccdb_joiner);<br \/>\n\t\t$ccdb_query = &#8220;INSERT INTO ccdb_supporters SET  timestamp = now(), helpnumrecords=&#8217;$ccdb_helpofferstring&#8217;, &#8220;;<br \/>\n\t\tforeach ($ccdb_WantedVariables as $ccdb_variable)<br \/>\n\t\t{<br \/>\n\t\t\t$answers[$ccdb_variable] = trim(strip_tags(stripslashes($_REQUEST[$ccdb_variable])));<br \/>\n\t\t\t$ccdb_query .= $ccdb_joiner.&#8221;$ccdb_variable='&#8221;.addslashes($answers[$ccdb_variable]).&#8221;&#8216;&#8221;;<br \/>\n\t\t\t$ccdb_joiner=&#8221;,&#8221;;<br \/>\n\t\t}<br \/>\n\t\t# echo $ccdb_query;<br \/>\n\t\t$ccdb_checkstring = $answers[&#8217;email&#8217;].$answers[&#8216;mobile&#8217;].$answers[&#8216;address1&#8217;].$answers[&#8216;homephone&#8217;];<br \/>\n\t\tif (empty($ccdb_checkstring)) {<br \/>\n\t\t\t$ccdb_topmessage = &#8220;<\/p>\n<p class=\\\"missinginfo\\\">Please can you provide some more information.<\/p>\n<p>&#8220;;<br \/>\n\t\t} else {<br \/>\n\t\t\t$ccdb_topmessage = &#8220;<\/p>\n<p>Thank you for registering your support.<\/p>\n<p>&#8220;;<br \/>\n\t\t\t$ccdb_result = mysql_query($ccdb_query);<br \/>\n\t\t}<\/p>\n<p>\t}<br \/>\n}<br \/>\n# if ($ccbd_ShowForm == &#8220;Yes&#8221;) {<br \/>\n\/* Now display the form *\/<br \/>\necho $ccdb_topmessage;<br \/>\necho &#8220;<\/p>\n<h3>I support Ming Campbell&#8217;s campaign<\/h3>\n<p>&#8220;;<br \/>\necho &#8216;<\/p>\n<form action=\"\" method=\"post\" name=\"supportinfo\" id=\"supporterform\" lang=\"en\">\n<table>&#8216;;<br \/>\n$questions = array(<br \/>\n\t&#8220;firstname&#8221; => &#8220;First name&#8221;,<br \/>\n\t&#8220;surname&#8221; => &#8220;Surname&#8221;,<br \/>\n\t&#8220;email&#8221; => &#8220;Email address&#8221;,<br \/>\n\t&#8220;mobile&#8221; => &#8220;Mobile phone*&#8221;,<br \/>\n\t&#8220;homephone&#8221; => &#8220;Home phone*&#8221;,<br \/>\n\t&#8220;membership&#8221; => &#8220;Lib Dem membership number*&#8221;,<br \/>\n\t&#8220;address1&#8221; => &#8220;Address*&#8221;,<br \/>\n\t&#8220;address2&#8221; => &#8220;&#8221;,<br \/>\n\t&#8220;address3&#8221; => &#8220;&#8221;,<br \/>\n\t&#8220;postcode&#8221; => &#8220;Postcode*&#8221;<br \/>\n);<br \/>\nputquestionsinrows($questions,$answers);<br \/>\n# State or region&#8230;<br \/>\necho &#8220;<\/p>\n<tr>\\n<\/p>\n<td>State or region<\/td>\n<td><select name=\\\"stateorregion\\\">&#8220;;<br \/>\n$ccdb_query = &#8220;SELECT * FROM ccdb_organisation WHERE (OrganisationType = 3 AND OrganisationParent = 3) or (OrganisationType = 2 and OrganisationNumber <> 3) ORDER BY OrganisationName&#8221;;<br \/>\n$ccdb_result = mysql_query($ccdb_query) or die(&#8220;Can&#8217;t run queries&#8221;);<br \/>\necho &#8220;<option value=\\\"\\\">Don&#8217;t know<\/option>\\n&#8221;;<br \/>\nwhile ($ccdb_row = mysql_fetch_array($ccdb_result)) {<br \/>\n\t\t\textract($ccdb_row,EXTR_PREFIX_ALL,&#8221;ccdb&#8221;);<br \/>\n\t\t\techo &#8220;<option value=\\\"$ccdb_OrganisationNumber\\\">$ccdb_OrganisationName<\/option>&#8220;;<br \/>\n}<br \/>\necho &#8220;<\/select>\\n&#8221;;<\/p>\n<p># Local party (if known)&#8230;<br \/>\necho &#8220;<\/p>\n<tr>\\n<\/p>\n<td>Local party<\/td>\n<td><select name=\\\"localparty\\\">&#8220;;<br \/>\n$ccdb_query = &#8220;SELECT * FROM ccdb_organisation WHERE OrganisationType = 7 ORDER BY OrganisationName&#8221;;<br \/>\n$ccdb_result = mysql_query($ccdb_query) or die(&#8220;Can&#8217;t run queries&#8221;);<br \/>\necho &#8220;<option value=\\\"\\\">Don&#8217;t know<\/option>\\n&#8221;;<br \/>\nwhile ($ccdb_row = mysql_fetch_array($ccdb_result)) {<br \/>\n\t\t\textract($ccdb_row,EXTR_PREFIX_ALL,&#8221;ccdb&#8221;);<br \/>\n\t\t\techo &#8220;<option value=\\\"$ccdb_OrganisationNumber\\\">$ccdb_OrganisationName<\/option>&#8220;;<br \/>\n}<br \/>\necho &#8220;<\/select>\\n&#8221;;<\/p>\n<p>echo &#8220;<\/p>\n<tr>\\n<\/p>\n<td>Would you like to receive news from the campaign via text or email?<\/td>\n<p>\\n<\/p>\n<td><input name=\\\"getmail\\\" type=\\\"checkbox\\\" value=\\\"yes\\\" checked=\\\"checked\\\" \/><\/td>\n<\/tr>\n<p>&#8220;;<\/p>\n<p># Reminder:<br \/>\necho &#8220;<\/table>\n<p>\\n<small>* Optional<\/small>\\n<\/p>\n<h3>I want to help Ming&#8217;s campaign<\/h3>\n<p>\\n<\/p>\n<table>&#8220;;<br \/>\n# And now the help questions<br \/>\n$ccdb_query = &#8220;SELECT * FROM ccdb_help ORDER BY helpsort,helpdesc&#8221;;<br \/>\n$ccdb_result = mysql_query($ccdb_query) or die(&#8220;Can&#8217;t run queries&#8221;);<br \/>\nwhile ($ccdb_row = mysql_fetch_array($ccdb_result)) {<br \/>\n\t\t\textract($ccdb_row,EXTR_PREFIX_ALL,&#8221;ccdb&#8221;);<br \/>\n\t\t\techo &#8220;<\/p>\n<tr>\\n<\/p>\n<td>$ccdb_helpdesc<\/td>\n<p>\\n<\/p>\n<td><input type=\\\"checkbox\\\" value=\\\"Yes\\\" name=\\\"helpoffer['$ccdb_helpnum']\\\" \/><\/td>\n<\/tr>\n<p>&#8220;;<br \/>\n}<br \/>\necho &#8216;<\/table>\n<p><button type=\"submit\" name=\"submitsupporter\" value=\"submit\">Submit<\/button><br \/>\n<\/form>\n<p>&#8216;;<br \/>\n# }<\/p>\n<p>?><\/phpcode>\n<small>Menzies Campbell and his campaign team may use the information you supply to contact you with details of his campaign. Please let us know if you would prefer not to contacted in this way.<\/small><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Menzies Campbell and his campaign team may use the information you supply to contact you with details of his campaign. Please let us know if you would prefer not to contacted in this way.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":20,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-9","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"http:\/\/www.mingcampbell.org.uk\/ccarchive\/wp-json\/wp\/v2\/pages\/9","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.mingcampbell.org.uk\/ccarchive\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/www.mingcampbell.org.uk\/ccarchive\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/www.mingcampbell.org.uk\/ccarchive\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.mingcampbell.org.uk\/ccarchive\/wp-json\/wp\/v2\/comments?post=9"}],"version-history":[{"count":0,"href":"http:\/\/www.mingcampbell.org.uk\/ccarchive\/wp-json\/wp\/v2\/pages\/9\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.mingcampbell.org.uk\/ccarchive\/wp-json\/wp\/v2\/media?parent=9"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}