junestag
05-25-2008, 11:39 PM
Absolutely:
<?php
session_start();
if ((isset($_SESSION['username'])) && (isset($_SESSION['password']))) {
// initialize variables
$states = array('Statewide','Adams County','Asotin County','Benton County','Chelan County','Clallam County','Clark County','Columbia County','Cowlitz County','Douglas County','Ferry County','Franklin County','Garfield County','Grant County','Grays Harbor County','Island County','Jefferson County','King County','Kitsap County','Kittitas County','Klickitat County','Lewis County','Lincoln County','Mason County','Okanogan County','Pacific County','Pend Oreille County','Pierce County','San Juan County','Skagit County','Skamania County','Snohomish County','Spokane County','Stevens County','Thurston County','Wahkiakum County','Walla Walla County','Whatcom County','Whitman County','Yakima County');
$option_block1 = "";
$display_block = "";
// populate states dropdown
for ($i=0; $i < 40; $i++) {
$option_block1 .= "<option value=\"$states[$i]\">$states[$i]</option>";
}
// create html form
$display_block ="
<form method=\"post\" action=\"addrecord.php\" id=\"record\" name=\"record\" onsubmit=\"return checkform();\">
<fieldset>
<legend>PROVIDER INFORMATION</legend>
<table class=\"formtable\">
<tr>
<td class=\"label\">Provider Name:</td><td><input type=\"text\" id=\"provider_name\" name=\"provider_name\" size=\"50\" /> <font color=\"red\"<strong>REQUIRED FIELD</strong></font></td></tr>
<tr>
<td class=\"label\">Contact First Name:</td><td><input type=\"text\" id=\"contact_fname\" name=\"contact_fname\" size=\"30\" /></td></tr>
<tr>
<td class=\"label\">Contact Last Name:</td><td><input type=\"text\" id=\"contact_lname\" name=\"contact_lname\" size=\"30\" /></td></tr>
<tr>
<td class=\"label\">Phone:</td><td><input type=\"text\" id=\"phone\" name=\"phone\" size=\"10\" /></td></tr>
<tr>
<td class=\"label\">E-mail:</td><td><input type=\"text\" id=\"email\" name=\"email\" size=\"30\" /></td></tr>
<tr>
<td class=\"label\">URL:</td><td><input type=\"text\" id=\"url\" name=\"url\" size=\"50\" /></td></tr>
<tr>
<td class=\"label\">Eligibility Requirements:</td><td><textarea name=\"eligibility_req\" cols=\"90\" rows=\"12\"></textarea></td></tr>
<tr>
<td class=\"label\">Program Description:</td><td><textarea name=\"program_desc\" cols=\"90\" rows=\"12\"></textarea></td></tr>
<tr>
<td class=\"label\">Deadline:</td><td><select name=\"deadline\" id=\"deadline\"><option value=\"yes\">yes</option><option value=\"no\">no</option></select></td></tr>
<tr>
<td class=\"label\">Application Procedures:</td><td><input type=\"text\" id=\"app_proc\" name=\"app_proc\" size=\"50\" value=\"See Website\" /></td></tr>
<tr>
<td class=\"label\">Geographic Scope:<br />
(may select multiple)
</td>
<td><select name=\"geo_scope0[]\" style=\"width:auto\" id=\"1\" size=\"6\">$option_block1</select><button type=\"button\" onClick=\"putIn(2,1)\">Add >></button><br /><button type=\"button\" onClick=\"putIn(1,2)\"><< Remove</button><select name=\"geo_scope[]\" id=\"2\" style=\"width:auto\" size=\"6\"></td></tr>
</table>
</fieldset>
<div align=\"center\">
<input type=\"submit\" name=\"submit\" value=\"Add this Record\" class=\"submit\" id=\"submit\" /></div>
</form>";
?>
<html>
<head>
<title>Enter a New Record</title>
<link rel="stylesheet" href="style/infra-db.css" type="text/css">
<script src="scripts/checkform.js" type="text/javascript"></script>
<script type="text/javascript">
function putIn(to,from){
var x = document.getElementById(from);
var i = document.getElementById(to);
var opt = new Option(x.options[x.selectedIndex].text, x.options[x.selectedIndex].value);
i.add(opt, undefined);
x.remove(x.selectedIndex);
}
</script>
</head>
<body>
<div class="header">
<p class="title">Washington Infrastructure Database</p>
<p class="subtitle">Add New Record</p>
<p class="links"><strong>Add Record</strong> | Modify Record | <a href="pick_viewrecord.php">View Records</a></p>
</div>
<?php
echo "$display_block";
} else { header("Location: http://" . $_SERVER['HTTP_HOST'] .
dirname($_SERVER['PHP_SELF']) . "/login.php");
exit(); }?>
</body>
</html>
junestag
05-25-2008, 11:50 PM
Yes, it's here. You'll notice there are a lot more fields i'm processing from the previous form (i edited those out of my last post to be less confusing for you).
<?php
session_start();
if ((isset($_SESSION['username'])) && (isset($_SESSION['password']))) {
//includes
include("connection.php");
include("escape.php");
// set variables
$geo_scope = $_POST['geo_scope'];
if (isset($geo_scope) && ($geo_scope != "")) {
foreach ($geo_scope as $v) {
switch ($v) {
case 'Statewide':
$statewide = 'statewide';
break;
case 'Adams County':
$adams = 'adams';
break;
case 'Asotin County':
$asotin = 'asotin';
break;
case 'Benton County':
$benton = 'benton';
break;
case 'Chelan County':
$chelan = 'chelan';
break;
case 'Clallam County':
$clallam = 'clallam';
break;
case 'Clark County':
$clark = 'clark';
break;
case 'Columbia County':
$columbia = 'columbia';
break;
case 'Cowlitz County':
$cowlitz = 'cowlitz';
break;
case 'Douglas County':
$douglas = 'douglas';
break;
case 'Ferry County':
$ferry = 'ferry';
break;
case 'Franklin County':
$franklin = 'franklin';
break;
case 'Garfield County':
$garfield = 'garfield';
break;
case 'Grant County':
$grant = 'grant';
break;
case 'Grays Harbor County':
$grays_harbor = 'grays harbor';
break;
case 'Island County':
$island = 'island';
break;
case 'Jefferson County':
$jefferson = 'jefferson';
break;
case 'King County':
$king = 'king';
break;
case 'Kitsap County':
$kitsap = 'kitsap';
break;
case 'Kittitas County':
$kittitas = 'kittitas';
break;
case 'Klickitat County':
$klickitat = 'klickitat';
break;
case 'Lewis County':
$lewis = 'lewis';
break;
case 'Lincoln County':
$lincoln = 'lincoln';
break;
case 'Mason County':
$mason = 'mason';
break;
case 'Okanogan County':
$okanogan = 'okanogan';
break;
case 'Pacific County':
$pacific = 'pacific';
break;
case 'Pend Oreille County':
$pend_oreille = 'pend_oreille';
break;
case 'Pierce County':
$pierce = 'pierce';
break;
case 'San Juan County':
$san_juan = 'san juan';
break;
case 'Skagit County':
$skagit = 'skagit';
break;
case 'Skamania County':
$skamania = 'skamania';
break;
case 'Snohomish County':
$snohomish = 'snohomish';
break;
case 'Spokane County':
$spokane = 'spokane';
break;
case 'Stevens County':
$stevens = 'stevens';
break;
case 'Thurston County':
$thurston = 'thurston';
break;
case 'Wahkiakum County':
$wahkiakum = 'wahkiakum';
break;
case 'Walla Walla County':
$walla_walla = 'walla walla';
break;
case 'Whatcom County':
$whatcom = 'whatcom';
break;
case 'Whitman County':
$whitman = 'whitman';
break;
case 'Yakima County':
$yakima = 'yakima';
break;
}
}
}
$last_updated = date('Y-m-d');
$provider_name = escape_data($_POST['provider_name']);
$contact_fname = escape_data($_POST['contact_fname']);
$contact_lname = escape_data($_POST['contact_lname']);
$phone = escape_data($_POST['phone']);
$email = escape_data($_POST['email']);
$url = escape_data($_POST['url']);
$eligibility_req = escape_data(nl2br($_POST['eligibility_req']));
$program_desc = escape_data(nl2br($_POST['program_desc']));
$app_proc = escape_data($_POST['app_proc']);
$deadline = $_POST['deadline'];
$sql = "INSERT INTO providers (provider_name, contact_fname, contact_lname, phone, email, url, eligibility_req, statewide, adams, asotin, benton, chelan, clallam, clark, columbia, cowlitz, douglas, ferry, franklin, garfield, grantt, grays_harbor, island, jefferson, king, kitsap, kittitas, klickitat, lewis, lincoln, mason, okanogan, pacific, pend_oreille, pierce, san_juan, skagit, skamania, snohomish, spokane, stevens, thurston, wahkiakum, walla_walla, whatcom, whitman, yakima, el_all, el_cities_towns, el_county, el_state, el_federal, el_nat, el_nonprofit, el_private, el_individual, el_spd, el_other, sc_all, sc_grants, sc_loans_pri, sc_gloans, sc_ta, sc_other, description, app_procedures, last_updated, ced_all, ced_disaster, ced_bus_incubators, ced_historic_pres, ced_housing, ced_industrial, ced_nr, ced_pub_safety, ced_research, ced_rural_plan, ced_sust_dev, ced_urb_plan, ced_other, comm_all, comm_broadcast, comm_tele, comm_other, ed_all, ed_childcare, ed_k12, ed_he, ed_lib, ed_comm_ed, ed_research, ed_other, ener_all, ener_alt, ener_coal, ener_elec, ener_hydro, ener_nuclear, ener_solar, ener_wind, ener_other, ener_bio, env_all, env_ag, env_brownfields, env_ener_eff, env_forestry, env_grazing, env_green_bldg, env_landscaping, env_landuse, env_riparian, env_sp, env_other, pf_all, pf_art, pf_comm_centers, pf_ad_al, pf_fs, pf_ps, pf_pj, pf_pl, pf_health_fac, pf_mun_bldgs, pf_museums, pf_other, rec_all, rec_greenbelt, rec_outdoor, rec_parks, rec_sports, rec_trails, rec_other, rec_play, trans_all, trans_air, trans_bridges, trans_marine, trans_offroad, trans_pt, trans_ped_bike, trans_parking, trans_pub_lighting, trans_streets, trans_rail, trans_other, wm_all, wm_hazard, wm_recycling, wm_solid_waste, wm_waste_water, wm_other, water_all, water_dams, water_irr, water_storm, water_drinking, water_flood, water_other, pp_all, pp_planning, pp_feas, pp_design, pp_construction, pp_other, deadline) VALUES ('$provider_name', '$contact_fname', '$contact_lname', '$phone', '$email', '$url', '$eligibility_req', '$statewide', '$adams', '$asotin', '$benton', '$chelan', '$clallam', '$clark', '$columbia', '$cowlitz', '$douglas', '$ferry', '$franklin', '$garfield', '$grant', '$grays_harbor', '$island', '$jefferson', '$king', '$kitsap', '$kittitas', '$klickitat', '$lewis', '$lincoln', '$mason', '$okanogan', '$pacific', '$pend_oreille', '$pierce', '$san_juan', '$skagit', '$skamania', '$snohomish', '$spokane', '$stevens', '$thurston', '$wahkiakum', '$walla_walla', '$whatcom', '$whitman', '$yakima', '$el_all', '$el_cities_towns', '$el_county_gov', '$el_state_gov', '$el_fed_gov', '$el_nat', '$el_nonprofit', '$el_private', '$el_ind', '$el_spd', '$el_other', '$sc_all', '$sc_grants', '$sc_loans_pri', '$sc_g_loans', '$sc_ta', '$sc_other', '$program_desc', '$app_proc', '$last_updated', '$ced_all', '$ced_dr_aid', '$ced_bi', '$ced_hp', '$ced_housing', '$ced_ind_park', '$ced_nr', '$ced_ps', '$ced_research', '$ced_rural', '$ced_sd', '$ced_up', '$ced_other', '$comm_all', '$comm_bs', '$comm_tele', '$comm_other', '$ed_all', '$ed_childcare', '$ed_k12', '$ed_he', '$ed_lib', '$ed_ce', '$ed_rf', '$ed_other', '$en_all', '$en_ae', '$en_coal', '$en_elec', '$en_hydro', '$en_nuc', '$en_solar', '$en_wind', '$en_other', '$en_bio', '$env_all', '$env_ag', '$env_brown', '$env_ee', '$env_forest', '$env_grazing', '$env_gb', '$env_landscaping', '$env_lup', '$env_riparian', '$env_shoreline', '$env_other', '$pf_all', '$pf_art', '$pf_cc', '$pf_adal', '$pf_fire', '$pf_ps', '$pf_prisons', '$pf_pl', '$pf_hcf', '$pf_mb', '$pf_museums', '$pf_other', '$rec_all', '$rec_greenbelt', '$rec_or', '$rec_parks', '$rec_sports', '$rec_trails', '$rec_other', '$rec_playgrounds', '$trans_all', '$trans_air', '$trans_bridges', '$trans_marine', '$trans_ors', '$trans_pts', '$trans_pbf', '$trans_park', '$trans_pl', '$trans_streets', '$trans_rs', '$trans_other', '$wm_all', '$wm_hazard', '$wm_recycle', '$wm_sw', '$wm_wwss', '$wm_other', '$water_all', '$water_dams', '$water_irrigation', '$water_storm', '$water_drinking', '$water_flood', '$water_other', '$pp_all', '$pp_planning', '$pp_feas', '$pp_design', '$pp_construct', '$pp_other', '$deadline')";
$result = @mysql_query($sql,$connection) or die(mysql_error());
?>
<html>
<head>
<title>Record Added Successfully</title>
<link rel="stylesheet" href="style/infra-db.css" type="text/css">
</head>
<body>
<div class="header">
<p class="title">Washington Infrastructure Database</p>
<p class="subtitle">Record Added Successfully</p>
<p class="links"><a href="show_add.php">Add Record</a> | Modify Record | <a href="pick_viewrecord.php">View Records</a></p>
</div>
<?php
} else { header("Location: http://" . $_SERVER['HTTP_HOST'] .
dirname($_SERVER['PHP_SELF']) . "/login.php");
exit(); }?>
</body>
</html>
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.