Quantcast
Viewing all articles
Browse latest Browse all 44

$wpdb to insert html form information

I’m trying to insert posted variables from a form. When I shorten the amount of variables I’m inserting it will sometime pass the information in my mysql database. Once I continue to add on information to be added to the database it doesn’t pass any information in. I also believe there is a better way to do this, however I haven’t figured it out yet.

<?php
global $wpdb; 

$tablename="association";
If($_POST['submit']) {

$wpdb->insert($tablename, array(

    'association_name' => $_POST['legalName'],
    'association_url' => $_POST['url'],
    'association_state' => $_POST['state'],
    'association_city' => $_POST['city'],
    'association_zip' => $_POST['zip'],
    'boardmember_fname' => $_POST['firstName'], 
    'boardmember_lname' => $_POST['lastName'],
    'boardmember_title_president' => $_POST['president'],
    'boardmember_title_vice_president' => $_POST['vicePresident'],
    'boardmember_title_treasurer' => $_POST['treasurer'],
    'boardmember_title_secretary' => $_POST['secretary'],
    'boardmember_title_director' => $_POST['director'],
    'boardmember_title_association_manager' => $_POST['propertyManager'],
    'boardmember_email' => $_POST['email'],
    'association_management' => $_POST['management'],
    'association_onsite' => $_POST['onsite'],
    'association_master' => $_POST['master'],
    'association_sales_price' => $_POST['averageSales'],
    'association_age_restriction' => $_POST['ageRestriction'],
    'association_homes' => $_POST['homes'],
    'association_anticipated_construction' => $_POST['anticipatedConstruction'],
    'association_end_construction' => $_POST['endConstruction'],
    'association_pets'=> $_POST['pet'],
    'association_description'=> $_POST['description'],
    'association_images'=> $_POST['pic'],
    'clubhouse_rental' => $_POST['rentable'],
    'clubhouse_billiards' => $_POST['billards'], //Not spelt correctly 
    'clubhouse_card_room' => $_POST['cardroom'],
    'clubhouse_exercise_room' => $_POST['exerciseroom'],
    'clubhouse_fireplace' => $_POST['fireplace'],
    'clubhouse_hot_tub' => $_POST['hottub'],
    'clubhouse_kitchen' => $_POST['kitchen'],
    'clubhouse_library' => $_POST['library'],
    'clubhouse_locker_rooms' => $_POST['lockerrooms'],
    'clubhouse_music_system' => $_POST['musicsystems'],
    'clubhouse_outdoor_deck_patio' => $_POST['outdoordeckpatio'],
    'clubhouse_sauna' => $_POST['sauna'],
    'clubhouse_showers' => $_POST['showers'],
    'clubhouse_social_directors' => $_POST['socialdirectors'],
    'clubhouse_steam_room' => $_POST['steamroom'],
    'clubhouse_tv' => $_POST['tv'],
    'clubhouse_wireless_internet' => $_POST['wirelessinternet']
    'style_cape' => $_POST['cape'],
    'style_colonial' => $_POST['colonial'],
    'style_cottage' => $_POST['cottage'],
    'style_georgian' => $_POST['georgian'],
    'style_half_duplex' => $_POST['halfduplex'],
    'style_high_rise' => $_POST['highrise'],
    'style_low_rise' => $_POST['lowrise'],
    'style_mid_rise' => $_POST['midrise'],
    'style_single_family_home' => $_POST['singlefamilyhome'],
    'style_townhouse' => $_POST['townhouse'],
    'storage_in_unit' => $_POST['inUnit'], 
    'storage_building_assigned' => $_POST['buildingAssignedArea'],
    'storage_fcfs' => $_POST['firstCome'],
    'trash_individual_bins' => $_POST['individualBins'], 
    'trash_community_bins' => $_POST['communityBins'],
    'trash_chutes' => $_POST['trashChutes'],
    'trash_compactor' => $_POST['compactor'],
    'security_cameras' => $_POST['cameras'],
    'security_gate' => $_POST['gate'],
    'security_fencing' => $_POST['fencing'],
    'security_secured_hallways' => $_POST['securedHallways'],
    'security_patrol' => $_POST['securityPatrol'],
    'maintenance_landscaping' => $_POST['landscaping'], 
    'maintenance_building' => $_POST['buildingMaintenance'],
    'maintenance_snow_ice' => $_POST['snowIceRemoval'],
    'bedrooms_1' => $_POST['1bedroom'], 
    'bedrooms_2' => $_POST['2bedroom'],
    'bedrooms_3' => $_POST['3bedroom'],
    'bedrooms_4' => $_POST['4bedroom'],
    'parking_driveway' => $_POST['drivewayParking'],
    'parking_car_ports' => $_POST['carPorts'],
    'parking_visitor_parking' => $_POST['visitorParking'],
    'parking_street_parking' => $_POST['streetParking'],
    'parking_garage'=>$_POST['parkingGarage'],
    'garages_1space' => $_POST['1space'], 
    'garages_2space' => $_POST['2space'],
    'garages_3space' => $_POST['3space'],
    'garages_no_garages' => $_POST['noGarages'],
    'mailbox_indoor_station' => $_POST['indoorMailboxStation'], 
    'mailbox_outdoor_station' => $_POST['outdoorMailboxStation'],
    'mailbox_personal_mailbox' => $_POST['personalMailbox'],
    'amenity_basketball' => $_POST['basketball'],
    'amenity_beach_rights' => $_POST['beachrights'],
    'amenity_small_craft_boats' => $_POST['smallcraftboats'],
    'amenity_boating_slips' => $_POST['boatingslips'],
    'amenity_bocce_court' => $_POST['boccecourt'],
    'amenity_childrens_pool' => $_POST['childrenspool'],
    'amenity_clubhouse' => $_POST['clubhouse'],
    'amenity_community_gardens' => $_POST['communitygardens'],
    'amenity_day_care' => $_POST['daycare'],
    'amenity_elevator' => $_POST['elevator'],
    'amenity_fishing' => $_POST['fishing'],
    'amenity_golf' => $_POST['golf'],
    'amenity_indoor_pool' => $_POST['indoorpool'],
    'amenity_outdoor_pool' => $_POST['outdoorpool'],
    'amenity_pond' => $_POST['pond'],
    'amenity_racquetball' => $_POST['racquetball'],
    'amenity_restaurant' => $_POST['restaurant'],
    'amenity_skating_rink' => $_POST['skatingrink'],
    'amenity_skiing' => $_POST['skiing'],
    'amenity_tennis_court' => $_POST['tenniscourt'],
    'amenity_volleyball' => $_POST['volleyball'],
    'amenity_walking_trails' => $_POST['walkingtrails'],
    'amenity_waterfront' => $_POST['waterfront']



));

}

?>

If I only do the first four inserts, it will normally work. I need all of the information in one record as well.

Anyone have any thoughts?


Viewing all articles
Browse latest Browse all 44

Trending Articles