选中复选框时,mysql将enum从no更新为数据库中的复选框值

时间:2014-05-13 10:22:27

标签: php mysql

我正在尝试将表中的枚举值从no更新为复选框值(选中时)。但这不起作用,我只是得到这些未定义的索引错误:

Notice: Undefined index: scope_type_non_mechanical in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 16

Notice: Undefined index: scope_type_tools in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 17

Notice: Undefined index: scope_type_accessories in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 18

Notice: Undefined index: lifting in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 24

Notice: Undefined index: dumpers in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 25

Notice: Undefined index: excavators in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 26

Notice: Undefined index: ground_works in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 27

Notice: Undefined index: pumps in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 28

Notice: Undefined index: telehandlers in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 29

Notice: Undefined index: low_platforms in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 30

Notice: Undefined index: towable_bowsers in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 31

Notice: Undefined index: barriers in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 32

Notice: Undefined index: painting_dec in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 33

Notice: Undefined index: road_traffic in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 34

Notice: Undefined index: scaffolding in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 35

Notice: Undefined index: training in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 36

Notice: Undefined index: waste_management in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 37

Notice: Undefined index: plumbing in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 38

Notice: Undefined index: non_mec_lift in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 39

Notice: Undefined index: trench in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 40

Notice: Undefined index: screws_fixtures in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 41

Notice: Undefined index: transport in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 42

Notice: Undefined index: toilets in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 43

Notice: Undefined index: engineer_rail in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 44

Notice: Undefined index: screws_fixtures in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 45

Notice: Undefined index: survey in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 46

Notice: Undefined index: cleaning in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 47

Notice: Undefined index: heating_cooling in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 48

Notice: Undefined index: measuring in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 49

Notice: Undefined index: magnets in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 50

Notice: Undefined index: lighting in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 51

Notice: Undefined index: mixing_digging in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 52

Notice: Undefined index: safety in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 53

Notice: Undefined index: welding_grinding in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 54

Notice: Undefined index: forks_chains_slings in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 55

Notice: Undefined index: accom in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 56

Notice: Undefined index: saws_cutting in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 57

Notice: Undefined index: hammers in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 58

Notice: Undefined index: cleaning in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 59

Notice: Undefined index: communications_it in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 60

Notice: Undefined index: electrical in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 61

Notice: Undefined index: catering in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 62

Notice: Undefined index: equipment in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 63

Notice: Undefined index: office in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 64

Notice: Undefined index: ppe in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 65

Notice: Undefined index: marketing in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 66

Notice: Undefined index: training in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 67

Notice: Undefined index: security in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 68

Notice: Undefined index: techincal_pro_legal in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 69

Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php:46) in C:\xampp\htdocs\hewden_spms\supplier_function\supplier_scope_process.php on line 295
继续我的剧本,它应该工作,我不知道为什么它给出这些错误,有人pelase可以告诉我我哪里出错了

我在NETBEAN中获取笔记不是直接访问超全球,我想知道它是否可以与此相关?

<?php
session_start();

$db_hostname = 'localhost';
$db_database = 'hewden1'; 
$db_username = 'root';
$db_password = '';

$db_server = mysql_connect($db_hostname, $db_username, $db_password)    
        or die("Unable to connect to MySQL: " . mysql_error());

mysql_select_db($db_database)   
or die("Unable to select database: " . mysql_error());

 $scope_type_mechanical = $_POST['scope_type_mechanical'];
 $scope_type_non_mechanical = $_POST['scope_type_non_mechanical'];
 $scope_type_tools = $_POST['scope_type_tools'];
 $scope_type_accessories = $_POST['scope_type_accessories'];
 $ipaddress = $_SERVER["REMOTE_ADDR"];
 $access_platforms = $_POST['access_platforms'];
 $generators = $_POST['generators'];
 $compressors = $_POST['compressors'];
 $dozers= $_POST['dozers'];
 $lifting = $_POST['lifting'];
 $dumpers = $_POST['dumpers'];
 $excavators = $_POST['excavators'];
 $ground_works = $_POST['ground_works'];
 $pumps = $_POST['pumps'];
 $telehandlers = $_POST['telehandlers'];
 $low_platforms = $_POST['low_platforms'];
 $towable_bowsers = $_POST['towable_bowsers'];
 $barriers = $_POST['barriers'];
 $painting_dec = $_POST['painting_dec'];
 $road_traffic = $_POST['road_traffic'];
 $scaffolding = $_POST['scaffolding'];
 $training = $_POST['training'];
 $waste_management = $_POST['waste_management'];
 $plumbing = $_POST['plumbing'];
 $non_mec_lift = $_POST['non_mec_lift'];
 $trench = $_POST['trench'];
 $screws_fixtures = $_POST['screws_fixtures'];
 $transport = $_POST['transport'];
 $toilets = $_POST['toilets'];
 $engineer_rail = $_POST['engineer_rail'];
 $screws_fixtures = $_POST['screws_fixtures'];
 $survey = $_POST['survey'];
 $cleaning = $_POST['cleaning'];
 $heating_cooling = $_POST['heating_cooling'];
 $measuring = $_POST['measuring'];
 $magnets = $_POST['magnets'];
 $lighting = $_POST['lighting'];
 $mixing_digging = $_POST['mixing_digging'];
 $safety = $_POST['safety'];
 $welding_grinding = $_POST['welding_grinding'];
 $forks_chains_slings = $_POST['forks_chains_slings'];
 $accom = $_POST['accom'];
 $saws_cutting = $_POST['saws_cutting'];
 $hammers = $_POST['hammers'];
 $cleaning = $_POST['cleaning'];
 $communications_it = $_POST['communications_it'];
  $electrical = $_POST['electrical'];
   $catering = $_POST['catering'];
    $equipment = $_POST['equipment'];
     $office = $_POST['office'];
      $ppe = $_POST['ppe'];
      $marketing = $_POST['marketing'];
      $training = $_POST['training'];
      $security = $_POST['security'];
      $techincal_pro_legal = $_POST['techincal_pro_legal'];






$sql="INSERT INTO supplier_scope (user_ip, scope_type_mechanical, scope_type_non_mechanical, scope_type_tools, scope_type_accessories)
    VALUES ('$ipaddress', '$scope_type_mechanical', '$scope_type_non_mechanical', '$scope_type_tools', '$scope_type_accessories')";  

$result = mysql_query($sql); 

$sql2="UPDATE supplier_session SET form2_completed = 'Yes' WHERE form2_completed = 'No' AND user_IP = '$ipaddress'";

$result2 = mysql_query($sql2); 

if(isset($_POST['access_platforms'])){
$sql3="UPDATE supplier_scope SET access_platforms = '$access_platforms' WHERE access_platforms = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['generators'])){
$sql3="UPDATE supplier_scope SET generators = '$generators' WHERE generators = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['compressors'])){
$sql3="UPDATE supplier_scope SET compressors = '$compressors' WHERE compressors = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['dozers'])){
$sql3="UPDATE supplier_scope SET dozers = '$dozers' WHERE access_platforms = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['lifting'])){
$sql3="UPDATE supplier_scope SET lifting = '$lifting' WHERE access_platforms = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['dumpers'])){
$sql3="UPDATE supplier_scope SET dumpers = '$dumpers' WHERE dumpers = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['excavators'])){
$sql3="UPDATE supplier_scope SET excavators = '$excavators' WHERE excavators = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['ground_works'])){
$sql3="UPDATE supplier_scope SET ground_works = '$ground_works' WHERE ground_works = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['pumps'])){
$sql3="UPDATE supplier_scope SET pumps = '$pumps' WHERE pumps = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['telehandlers'])){
$sql3="UPDATE supplier_scope SET access_platforms = '$access_platforms' WHERE access_platforms = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['low_platforms'])){
$sql3="UPDATE supplier_scope SET low_platforms = '$low_platforms' WHERE low_platforms = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['barriers'])){
$sql3="UPDATE supplier_scope SET barriers = '$barriers' WHERE barriers = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['towable_bowsers'])){
$sql3="UPDATE supplier_scope SET towable_bowsers = '$towable_bowsers' WHERE towable_bowsers = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['painting_dec'])){
$sql3="UPDATE supplier_scope SET painting_dec = '$painting_dec' WHERE painting_dec = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['road_traffic'])){
$sql3="UPDATE supplier_scope SET road_traffic = '$road_traffic' WHERE road_traffic = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['scaffolding'])){
$sql3="UPDATE supplier_scope SET scaffolding = '$scaffolding' WHERE scaffolding = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['training'])){
$sql3="UPDATE supplier_scope SET training = '$training' WHERE training = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['operators'])){
$sql3="UPDATE supplier_scope SET operators = '$operators' WHERE operators = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['waste_management'])){
$sql3="UPDATE supplier_scope SET waste_management = '$waste_management' WHERE waste_management = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['plumbing'])){
$sql3="UPDATE supplier_scope SET plumbing = '$plumbing' WHERE plumbing = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['non_mec_lift'])){
$sql3="UPDATE supplier_scope SET non_mec_lift = '$non_mec_lift' WHERE non_mec_lift = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['trench'])){
$sql3="UPDATE supplier_scope SET trench = '$trench' WHERE trench = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['accom'])){
$sql3="UPDATE supplier_scope SET accom = '$accom' WHERE accom = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['transport'])){
$sql3="UPDATE supplier_scope SET transport = '$transport' WHERE transport = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['toilets'])){
$sql3="UPDATE supplier_scope SET toilets = '$toilets' WHERE toilets = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['cleaning'])){
$sql3="UPDATE supplier_scope SET cleaning = '$cleaning' WHERE cleaning = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['heating_cooling'])){
$sql3="UPDATE supplier_scope SET heating_cooling = '$heating_cooling' WHERE heating_cooling = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['measuring'])){
$sql3="UPDATE supplier_scope SET measuring = '$measuring' WHERE measuring = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['magnets'])){
$sql3="UPDATE supplier_scope SET magnets = '$magnets' WHERE magnets = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['lighting'])){
$sql3="UPDATE supplier_scope SET lighting = '$lighting' WHERE lighting = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['mixing_digging'])){
$sql3="UPDATE supplier_scope SET mixing_digging = '$mixing_digging' WHERE mixing_digging = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['safety'])){
$sql3="UPDATE supplier_scope SET safety = '$safety' WHERE safety = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['rope_harness'])){
$sql3="UPDATE supplier_scope SET rope_harness = '$rope_harness' WHERE rope_harness = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['mixing_digging'])){
$sql3="UPDATE supplier_scope SET mixing_digging = '$mixing_digging' WHERE mixing_digging = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['welding_grinding'])){
$sql3="UPDATE supplier_scope SET welding_grinding = '$welding_grinding' WHERE welding_grinding = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['forks_chains_slings'])){
$sql3="UPDATE supplier_scope SET mixing_digging = '$forks_chains_slings' WHERE forks_chains_slings = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['screws_fixtures'])){
$sql3="UPDATE supplier_scope SET screws_fixtures = '$screws_fixtures' WHERE screws_fixtures = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['engineer_rail'])){
$sql3="UPDATE supplier_scope SET engineer_rail = '$engineer_rail' WHERE engineer_rail = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['survey'])){
$sql3="UPDATE supplier_scope SET survey = '$survey' WHERE survey = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['saws_cutting'])){
$sql3="UPDATE supplier_scope SET saws_cutting = '$saws_cutting' WHERE saws_cutting = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['hammers'])){
$sql3="UPDATE supplier_scope SET hammers = '$hammers' WHERE hammers = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['communications_it'])){
$sql3="UPDATE supplier_scope SET communications_it = '$communications_it' WHERE communications_it = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['electrical'])){
$sql3="UPDATE supplier_scope SET electrical = '$electrical' WHERE electrical = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['catering'])){
$sql3="UPDATE supplier_scope SET catering = '$catering' WHERE catering = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['equipment'])){
$sql3="UPDATE supplier_scope SET equipment = '$equipment' WHERE equipment = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['office'])){
$sql3="UPDATE supplier_scope SET office = '$office' WHERE office = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['ppe'])){
$sql3="UPDATE supplier_scope SET ppe = '$ppe' WHERE ppe = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['contracts'])){
$sql3="UPDATE supplier_scope SET contracts = '$contracts' WHERE contracts = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['techincal_pro_legal'])){
$sql3="UPDATE supplier_scope SET techincal_pro_legal = '$techincal_pro_legal' WHERE techincal_pro_legal = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['security'])){
$sql3="UPDATE supplier_scope SET security = '$security' WHERE security = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['training'])){
$sql3="UPDATE supplier_scope SET training = '$training' WHERE training = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
if(isset($_POST['marketing'])){
$sql3="UPDATE supplier_scope SET marketing = '$marketing' WHERE marketing = 'No' AND user_IP = '$ipaddress'";
$result3 = mysql_query($sql3); 
}
 if($result){

    header("Location: index.php?registration=success");

}else {
echo "ERROR";
} 
?>

1 个答案:

答案 0 :(得分:0)

index未定义,因为您没有检查isset()条件

if(isset($_POST['update/submit']))
{
    $scope_type_mechanical = $_POST['scope_type_mechanical'];
    $scope_type_non_mechanical = $_POST['scope_type_non_mechanical'];
    ....continue

}
相关问题