473,395 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

submits all fields instead of checked ones only

machinex757
Hello,
I have a form that I need to submit to the database. It's mostly checkmarks to submit to the database but it only submits all feilds and not just the ones checked off, filled out. Below is the form and my PHP code. I really appreciate any help in advance. I'm really new at this and trying to learn. and I don't know which type, varchar, char ect to use. I get the form to submit but it shows all feilds in the database not just the ones checked off/filled out. Actuall it doesn't show any of the text from the text feilds at all. I'd really appreciate any help in advance. I'm very new at this and trying to learn is trying to understand a whole new language in a very short time. I'm doing this work for a non-profit if I can figure it out. Below is the form and my PHP code I don't know how to post them so it's in high lighted text..

FORM:
Expand|Select|Wrap|Line Numbers
  1. Southern Adirondack Independent Living
  2.  
  3. -Service Record-
  4.  
  5. Name: 
  6. Date: 
  7.  Male:
  8.  Female:
  9. Phone: 
  10. County: 
  11.  Person with Impairment:
  12.  Family Member/Significant Other:
  13. Other/Specify: 
  14. Business Agency: 
  15.  Advocacy/Legal Services: Assistance and or/representation in.
  16.  
  17.  Assistive Devices/Equipment Services: Provision of and training in use of, specialized devices and equipment such as TTY's, computers, or other information technology hardware or software, or the provision of assistance to obtain these devices and equipment from other sources.
  18.  
  19.  Benefits Advisement: Assistance provided to obtain economic.
  20.  
  21.  Architectural Barrier Services: Advice, information or assistance regarding removal of architectural barriers from any publicly or privately owned residence or other building or constructed facility, whether already built or in the planning stages, including preparation of detailed plans.
  22.  
  23.  Business/Industry/Agency Services: Services provided to businesses and agencies not specified elsewhere. E.G.: assistance provided to four individuals with impairments who work at ABC business to resolve dispute concerning a discriminatory practice. The number of employees with impairments should be counted here.
  24.  
  25.  Children's Services: The provision of specific IL services designed to serve individuals with significant impairments under the age of 5.
  26.  
  27.  Communication Services: Services directed to enable consumers to better communicate, such as interpreter services, training in communications equipment use, Braille instruction and reading services.
  28.  
  29.  Family Services: Services provided to family members of an individual with a significant impairment when necessary for improving the individual's ability to live and function more independently, or ability to engage in or continue in employment. Such services may include respite care. The service should be recorded in the CSR on behalf of whom services were provided.
  30.  
  31.  Housing, Home Modifications, and Other Shelter Services: Services directly related to securing housing or shelter, and/or modifying the house or shelter for a person with a significant impairment. services include assistance with reviewing and evaluating newspaper ads and training concerning communicating with landlords.
  32.  
  33.  
  34.  Voter Registration: Assistance provided to register individuals to vote.
  35.  
  36. Contact Summary: 
  37.  
  38. Staff Person/Date: 
  39.  
  40. Follow up: 
  41.  
  42. Staff Person/Date: 
[PHP]<?php
$textbox1name = $_POST['textbox1name'];
$textbox2date = $_POST['textbox2date'];
$check1male = $_POST['check1male'];
$check2female = $_POST['check2female'];
$text3phone = $_POST['text3phone'];
$textbox4county = $_POST['textbox4county'];
$check3personwithimpairment = $_POST['check3personwithimpairment'];
$check4family_member_significant_other = $_POST['check4family_member_significant_other'];
$textbox5other_specify = $_POST['textbox5other_specify'];
$textbox6business_agency = $_POST['textbox6business_agency'];
$chech5advocacy_legal_services = $_POST['chech5advocacy_legal_services'];
$check9_architectual_barrier_services = $_POST['check9_architectual_barrier_services'];
$check7_assistive_devices_equipment_services = $_POST['check7_assistive_devices_equipment_services'];
$check8_benefits_advisment = $_POST['check8_benefits_advisment'];
$check10_business_industry_agency_services = $_POST['check10_business_industry_agency_services'];
$check11_childrens_services = $_POST['check11_childrens_services'];
$check12_communication_services = $_POST['check12_communication_services'];
$check13_family_services = $_POST['check13_family_services'];
$check14_housing_home_modification_other_shelter_s ervices = $_POST['check14_housing_home_modification_other_shelter_s ervices'];
$chech15_il_skills_traing_life_skills_training = $_POST['chech15_il_skills_traing_life_skills_training'];
$check16_inforamtion_referral = $_POST['check16_inforamtion_referral'];
$check17_mobility_training = $_POST['check17_mobility_training'];
$check18_peer_counseling_services= $_POST['check18_peer_counseling_services'];
$check19_preventative_services = $_POST['check19_preventative_services'];
$check20_prostheses_orthics_other_appliances = $_POST['check20_prostheses_orthics_other_appliances'];
$check21_recreational_services = $_POST['check21_recreational_services'];
$check22_rehabilitation_technology_services = $_POST['check22_rehabilitation_technology_services'];
$check24_transportation_services = $_POST['check24_transportation_services'];
$check25_youth_services = $_POST['check25_youth_services'];
$check26_vocational_services = $_POST['check26_vocational_services'];
$check27_voter_reistration = $_POST['check27_voter_reistration'];
$textbox7_staff_person_date1 = $_POST['textbox7_staff_person_date1'];
$textbox8_staff_person_date2 = $_POST['textbox8_staff_person_date2'];
mysql_connect("localhost.ueuo.com", "67466", "febjan12") or die(mysql_error());
mysql_select_db("67466") or die(mysql_error());
mysql_query("INSERT INTO `servicerecord` (textbox1name, textbox2date, check1male, check2female, text3phone, textbox4county, check3personwithimpairment, check4family_member_significant_other, textbox5other_specify, textbox6business_agency, chech5advocacy_legal_services, check9_architectual_barrier_services, check7_assistive_devices_equipment_services, check8_benefits_advisment, check10_business_industry_agency_services, check11_childrens_services, check12_communication_services, check13_family_services, check14_housing_home_modification_other_shelter_se rvices, chech15_il_skills_traing_life_skills_training, check16_inforamtion_referral, check17_mobility_training, check18_peer_counseling_services, check19_preventative_services, check20_prostheses_orthics_other_appliances, check21_recreational_services, check22_rehabilitation_technology_services, check24_transportation_services, check25_youth_services, check26_vocational_services, check27_voter_reistration, textbox7_staff_person_date1, textbox8_staff_person_date2) VALUES ('$textbox1name', '$textbox2date', '$check1male', '$check2female', '$text3phone', '$textbox4county', '$check3personwithimpairment', '$check4family_member_significant_other', '$textbox5other_specify', '$textbox6business_agency', '$chech5advocacy_legal_services', '$check9_architectual_barrier_services', '$check7_assistive_devices_equipment_services', '$check8_benefits_advisment', '$check10_business_industry_agency_services', '$check11_childrens_services', '$check12_communication_services', '$check13_family_services', '$check14_housing_home_modification_other_shelter_ services', '$chech15_il_skills_traing_life_skills_training', '$check16_inforamtion_referral', '$check17_mobility_training', '$check18_peer_counseling_services', '$check19_preventative_services', '$check20_prostheses_orthics_other_appliances', '$check21_recreational_services', '$check22_rehabilitation_technology_services', '$check24_transportation_services', '$check25_youth_services', '$check26_vocational_services', '$check27_voter_reistration', '$textbox7_staff_person_date1', '$textbox8_staff_person_date2')");

if (mysql_affected_rows == 1) {
echo "Succeeded";
}else{
echo "Failed: ".mysql_affected_rows()." affected rows with Query: ".$query."<br />Error:".mysql_error();
}
?>
[/PHP]
Mar 8 '07 #1
5 1123
ronverdonk
4,258 Expert 4TB
I get the form to submit but it shows all feilds in the database not just the ones checked off/filled out. Actuall it doesn't show any of the text from the text feilds at all.
You do not check if a field is set or not or checked or not, you just fill all variables with unverified values from the $_POST array and then you insert all these variables into the database.

What text fields are you referring to? In order to verify that you must show the <form> into which the fields are entered by the user, not the form text as you showed us here. So please show that HTML <form> code script.

Ronald :cool:
Mar 8 '07 #2
gauravgmbhr
107 100+
You do not check if a field is set or not or checked or not, you just fill all variables with unverified values from the $_POST array and then you insert all these variables into the database.

What text fields are you referring to? In order to verify that you must show the <form> into which the fields are entered by the user, not the form text as you showed us here. So please show that HTML <form> code script.

Ronald :cool:
first u need to check whether the field is Set Or Not
if the feild is not set then it must be set to NULL other wise the query will show errors
there is difference between the empty string and NULL
NULL Can Be USED IN INSERTION but "" CANNOT BE USED
Mar 8 '07 #3
ronverdonk
4,258 Expert 4TB
NULL Can Be USED IN INSERTION but "" CANNOT BE USED
gauravgmbhr: where is this assumption based upon?? Of course you can insert an empty string into a table field!

Ronald :cool:
Mar 9 '07 #4
Hello,
Thanks for your kind help. The HTML form is below in two replies to fit the 1000 charater limit. I'm a little lost on the technical language if you can use lay mans terms it'll help greatly. thanks again. P.S> I add null and it still posts all feilds to the database and doen't show the text for the defined text feilds in the database. Thanks again.
[HTML]<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Southern Adirondack Independent Living</title>
</head>

<body>

<p id="contains_text1">Southern Adirondack Independent Living</p>
<p id="contains_text2">-Service Record-</p>
<p id="contains_name"><label for="name">Name:</label> <input id="name" name="textbox1name" size="38"></p>
<p id="contains_date"><label for="date">Date:</label> <input id="date" name="textbox2date" size="20"></p>
<p id="contains_check1"><input id="check1" type="checkbox" value="male" name="check1male">
<label for="check1">Male:</label></p>
<p id="contains_female"><input id="female" type="checkbox" value="female" name="check2female">
<label for="female">Female:</label></p>
<p id="contains_text3"><label for="text3">Phone:</label> <input id="text3" name="text3phone" size="20"></p>
<p id="contains_textbox4"><label for="textbox4">County:</label> <input id="textbox4" name="textbox4county" size="20"></p>
<p id="contains_check3"><input id="check3" type="checkbox" value="person with impairment" name="check3_person_with_impairment">
<label for="check3">Person with Impairment:</label></p>
<p id="contains_check4"><input id="check4" type="checkbox" value="family member significant other" name="check4_family_member_significant_other">
<label for="check4">Family Member/Significant Other:</label></p>
<p id="contains_textbox5"><label for="textbox5">Other/Specify:</label> <input id="textbox5" name="textbox5other_specify" size="35"></p>
<p id="contains_textbox6"><label for="textbox6">Business Agency:</label> <input id="textbox6" name="textbox6business_agency" size="40"></p>
<p id="contains_check5"><input id="check5" type="checkbox" value="advocacy legal services" name="chech5_advocacy_legal_services">
<label for="check5">Advocacy/Legal Services: Assistance and or/representation
in.</label></p>
<p id="contains_check7"><input id="check7" type="checkbox" value="assistive" name="check7_assistive_devices_equipment_services" >
<label for="check7">Assistive Devices/Equipment Services: Provision of and
training in use of, specialized devices and equipment such as TTY's, computers,
or other information technology hardware or software, or the provision of
assistance to obtain these devices and equipment from other sources.</label></p>
<p id="contains_check8"><input id="check8" type="checkbox" value="benefits" name="check8_benefits_advisment">
<label for="check8">Benefits Advisement: Assistance provided to obtain economic.</label></p>
<p id="contains_check9"><input id="check9" type="checkbox" value="architectual" name="check9_architectual_barrier_services">
<label for="check9">Architectural Barrier Services: Advice, information or
assistance regarding removal of architectural barriers from any publicly or
privately owned residence or other building or constructed facility, whether
already built or in the planning stages, including preparation of detailed
plans.</label></p>
<p id="contains_check10"><input id="check10" type="checkbox" value="business industry agency services" name="check10_business_industry_agency_services">
<label for="check10">Business/Industry/Agency Services: Services provided to
businesses and agencies not specified elsewhere. E.G.: assistance provided to
four individuals with impairments who work at ABC business to resolve dispute
concerning a discriminatory practice. The number of employees with impairments
should be counted here.</label></p>
<p id="contains_check11"><input id="check11" type="checkbox" value="childrens services" name="check11_childrens_services">
<label for="check11">Children's Services: The provision of specific IL services
designed to serve individuals with significant impairments under the age of 5.</label></p>
<p id="contains_check12"><input id="check12" type="checkbox" value="communication services" name="check12_communication_services">
<label for="check12">Communication Services: Services directed to enable
consumers to better communicate, such as interpreter services, training in
communications equipment use, Braille instruction and reading services.</label></p>
<p id="contains_check13"><input id="check13" type="checkbox" value="family services" name="check13_family_services">
<label for="check13">Family Services: Services provided to family members of an
individual with a significant impairment when necessary for improving the
individual's ability to live and function more independently, or ability to
engage in or continue in employment. Such services may include respite care. The
service should be recorded in the CSR on behalf of whom services were provided.</label></p>
<p id="contains_check14"><input id="check14" type="checkbox" value="housing home modification other shelter services" name="check14_housing_home_modification_other_shel ter_services">
<label for="check14">Housing, Home Modifications, and Other Shelter Services:
Services directly related to securing housing or shelter, and/or modifying the
house or shelter for a person with a significant impairment. services include
assistance with reviewing and evaluating newspaper ads and training concerning
communicating with landlords.</label></p>
<p id="contains_check15"><input id="check15" type="checkbox" value="il skills traing life skills training" name="chech15_il_skills_traing_life_skills_trainin g">
<label for="check15">IL Skills Training and Life Skills Training: Instruction to
develop IL skills in areas as personal care, coping, financial management,
social skills, and household management. this also includes education and
training necessary for living in the community and participating in community
activities.</label></p>
<p id="contains_check16"><input id="check16" type="checkbox" value="inforamtion referral" name="check16_inforamtion_referral">
<label for="check16">Information and Referral: Any provision of information or
referral for services and supports.</label></p>
<p id="contains_check17"><input id="check17" type="checkbox" value="mobility training" name="check17_mobility_training">
<label for="check17">Mobility Training: Services related to assisting consumers
to get around their home or community.</label></p>
<p id="contains_check18"><input id="check18" type="checkbox" value="peer counseling services" name="check18_peer_counseling_services">
<label for="check18">Peer Counseling Services: Counseling, teaching, information
sharing, and similar kinds of contact provided to consumers by other people with
impairments.</label></p>
<p id="contains_check19"><input id="check19" type="checkbox" value="preventative services" name="check19_preventative_services">
<label for="check19">Preventative Services: Services intended to prevent
additional impairments, or to prevent and increase in the severity of an
existing impairment. Services include wellness programs and linkage and referral
to physicians, psychiatric services, and/or other medical/clinical services.</label></p>
<p id="contains_check20"><input id="check20" type="checkbox" value="prostheses orthics other appliances" name="check20_prostheses_orthics_other_appliances" >
<label for="check20">Prostheses, Orthotics and Other Appliances: Provision of,
or assistance in obtaining through other sources, an adaptive device or
appliance to substitute for one or more parts of the human body.</label></p>
<p id="contains_check21"><input id="check21" type="checkbox" value="recreational services" name="check21_recreational_services">
<label for="check21">Recreational Services: Provision of or identification of
opportunities for the involvement of consumers in meaningful leisure time
activities. These may include such things as participation in community affairs
and other recreation activities that may be competitive, active or quiet.</label></p>
<p id="contains_check22"><input id="check22" type="checkbox" value="rehabilitation technology services" name="check22_rehabilitation_technology_services">
<label for="check22">Rehabilitation Technology Services: Provision of, or
assistance to obtain through other sources, adaptive modifications such as
wheelchairs and lifts, which address the barriers confronted by individuals with
significant impairments with respect to education, rehabilitation, employment, transportation,
IL, and/or recreation.</label></p>


</body>

</html>
[/HTML]
Mar 9 '07 #5
The end of the HTML.[HTML]<p id="contains_check24"><input id="check24" type="checkbox" value="transportation services" name="check24_transportation_services">
<label for="check24">Transportation services: Provision of, or arrangements for,
transportation.</label></p>
<p id="contains_check25"><input id="check25" type="checkbox" value="youth services" name="check25_youth_services">
<label for="check25">Youth Services: Specific IL services designed and provided
to individuals with significant impairments aged 5 - 19. These services may
include training to develop skills specifically designed for youth to promote
self-awareness and self-esteem, develop advocacy and self empowerment skills,
and explore career options.</label></p>
<p id="contains_check26"><input id="check26" type="checkbox" value="vocational services" name="check26_vocational_services">
<label for="check26">Vocational services: Any service designed to achieve or
maintain employment.</label></p>
<p id="contains_check27"><input id="check27" type="checkbox" value="voter reistration" name="check27_voter_reistration">
<label for="check27">Voter Registration: Assistance provided to register
individuals to vote.</label></p>[/HTML]
Mar 9 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: allyn44 | last post by:
HI--what I am trying to do is 2 things: 1. Open a form in either data entry mode or edit mode depending on what task the user is performing 2. Cancel events tied to fields on the form if I am in...
3
by: Ross McLean | last post by:
Hi all, I've been teaching myself C# for a new project at work. I have a bit of a background in c++ and java but never been what you could call a guru. I'm having some strange things happening...
9
by: Jimbo | last post by:
Hello, I have a user request to build a form in an Access database where the user can check off specific fields to pull in a query. For example, let's say I have 10 fields in a table. The user...
7
by: Dan | last post by:
(Using Classic ASP & MS Access) I have a page that has 120 fields on it (mostly checkboxes). I cannot split this into smaller pages. So what i want to do is write a class that handles this. in...
60
by: Dave | last post by:
I'm never quite sure whether to use "this." or not when referring to fields or properties in the same class. It obviously works just fine without it but sometimes I wonder if using this....
92
by: Ray | last post by:
I just moved to another company that's mainly a Java/.NET shop. I was happy to find out that there's a movement from the grassroot to try to convince the boss to use a dynamic language for our...
2
by: Aaron Reimann | last post by:
I have a lot of check boxes. This is an update of the check boxes, I want something was checked, then to do an insert (which is currently working), if something is no longer checked...delete the...
10
by: Bishman | last post by:
Hi, I need to programmatically allow or disallow the selection of multiple checkboxes on a form . At certain times I only want to allow a single selection, at other times I may wish to allow...
482
by: bonneylake | last post by:
Hey Everyone, Well i am not sure if this is more of a coldfusion problem or a javscript problem. So if i asked my question in the wrong section let me know an all move it to the correct place. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.