From 511562b5b78be5e6e3387ec30e21a6b981ec1a09 Mon Sep 17 00:00:00 2001 From: jacob Date: Tue, 6 Oct 2009 21:32:13 +0000 Subject: [PATCH] Getting started on building the "Manage Campaigns" forms --- admin/fundraising_campaigns.php | 124 ++++++++++++++++++++++++++++++-- 1 file changed, 120 insertions(+), 4 deletions(-) diff --git a/admin/fundraising_campaigns.php b/admin/fundraising_campaigns.php index 9db37c7..0d28c3c 100644 --- a/admin/fundraising_campaigns.php +++ b/admin/fundraising_campaigns.php @@ -23,26 +23,142 @@ $id)); + + }else{ + $id = $_POST["campaign_id"]; + // we are updating an existing campaign. + echo "Updating an existing campaign
\n"; + + // build our query + $formfields = array('name', 'type', 'startdate', 'enddate', 'active', 'target', 'fundraising_goal', 'fiscalyear'); + $updates = false; + $query = "UPDATE fundraising_campaigns SET "; + foreach($formfields AS $fieldname){ + if(array_key_exists($fieldname, $_POST)){ + $updates = true; + $query .= $fieldName . "='" . mysql_escape_string(stripslashes($_POST[$fieldname])) . ","; + } + } + if($updates = true){ + $query = rtrim($query, ",") . " WHERE id=" . $id; + } + + // and execute it + echo $query; //FIXME - not yet tested + } +} + +send_header("Campaign Management", array('Committee Main' => 'committee_main.php', 'Administration' => 'admin/index.php', 'Fundraising' => 'admin/fundraising.php'), "fundraising" ); - ?> + +

+
+ + + + + + + + + + +
">
+ +
+

Campaign 123