我遇到了这个问题,我的表单只发布了没有任何值的列本身。我试图找出问题所在,但没有任何运气。我的想法是变量有问题,但真的不知道出了什么问题。
编辑:我已经解决了这个问题,它不是 PDO/php。只是 html 表单的结构错误,现在已修复多个表单。感谢所有的帮助!
<?php
include ('../functions.php');
$forare = $_POST ['forare'];
$sjukskot = $_POST ['sjukskot'];
$rakel = $_POST ['rakel'];
$id = $_POST ['id'];
$tillstand = $_POST ['tillstand'];
$medvet = $_POST ['medvet'];
$andn = $_POST ['andn'];
$puls = $_POST ['puls'];
$blodt = $_POST ['blodt'];
$triage = $_POST ['triage'];
$medvet2 = $_POST ['medvet2'];
$andn2 = $_POST ['andn2'];
$puls2 = $_POST ['puls2'];
$blodt2 = $_POST ['blodt2'];
$triage2 = $_POST ['triage2'];
$behandling = $_POST ['behandling'];
$anamnes = $_POST ['anamnes'];
require_once('../configs/dbconfigpdo.php');
try{
$query = "INSERT INTO ambjournal (forare, sjukskot, rakel, id, tillstand, medvet, andn, puls, blodt, triage, medvet2, andn2, puls2, blodt2, triage2, behandling, anamnes) VALUES ('$forare', '$sjukskot', '$rakel', '$id', '$tillstand', '$medvet', '$andn', '$puls', '$blodt', '$triage', '$medvet2', '$andn2', '$puls2', '$blodt2', '$triage2', '$behandling', '$anamnes');";
$stmt = $db->prepare($query);
$stmt->bindparam(":forare",$forare);
$stmt->bindparam(":sjukskot",$sjukskot);
$stmt->bindparam(":rakel",$rakel);
$stmt->bindparam(":id",$id);
$stmt->bindparam(":tillstand",$tillstand);
$stmt->bindparam(":medvet",$medvet);
$stmt->bindparam(":andn",$andn);
$stmt->bindparam(":puls",$puls);
$stmt->bindparam(":blodt",$blodt);
$stmt->bindparam(":triage",$triage);
$stmt->bindparam(":medvet2",$medvet2);
$stmt->bindparam(":andn2",$andn2);
$stmt->bindparam(":puls2",$puls2);
$stmt->bindparam(":blodt2",$blodt2);
$stmt->bindparam(":triage2",$triage2);
$stmt->bindparam(":behandling",$behandling);
$stmt->bindparam(":anamnes",$anamnes);
$stmt->execute();
header ('Location: ../ambulansjournal.php');
exit();
}
catch(PDOException $exception){
die('ERROR: ' . $exception->getMessage());
}
?>
慕妹3146593
MM们
繁花不似锦