我目前在我的网站上制作了一个php表单,将信息发送到我的数据库,但是当有人使用它时,它只将4个输入字段中的两个发布到数据库,请参阅下面链接的图像。 / p>
通过挪威语写的方式退款网站,如果需要请使用Google翻译:D
这是我的refund.php:
<html>
<head>
<link type="text/css" media="all" href="https://bootswatch.com/4/lumen/bootstrap.min.css" rel="stylesheet" />
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<meta charset="utf-8" />
<title>NattLAN</title>
<meta name="author" content="ukieweb" />
<meta name="keywords" content="soon, css3, template, html5 template" />
<meta name="description" content="Balk - Page Template" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<!-- Favicons -->
<link rel="apple-touch-icon" sizes="144x144" href="assets/img/favicons/apple-touch-icon-144x144.png" />
<link rel="apple-touch-icon" sizes="114x114" href="assets/img/favicons/apple-touch-icon-114x114.png" />
<link rel="apple-touch-icon" sizes="72x72" href="assets/img/favicons/apple-touch-icon-72x72.png" />
<link rel="apple-touch-icon" href="assets/img/favicons/apple-touch-icon.png" />
<link rel="shortcut icon" href="assets/img/favicons/favicon.png" />
<!-- Google Fonts -->
<link href='http://fonts.googleapis.com/css?family=Exo+2:400,100,100italic,200,200italic,300,300italic,400italic,500,500italic,600,600italic,700,700italic,800,800italic,900,900italic' rel='stylesheet' type='text/css'>
<style>
body {
background-color: #F0F0F0;
}
</style>
</head>
<body>
<!DOCTYPE html>
<p align="center"><img src="http://24.media.tumblr.com/0128a30614276768bf956ad868604b5d/tumblr_n6zhprHRGv1qgefibo1_400.gif"></p>
<p> </p>
<h3 align="center" color="black"> Refunderingsskjema</h3>
<form action="send.php" method="post">
<p align="center">Navn på deltaker:<br></p>
<p align="center"><input type="text" name="u_deltaker" required><br></p>
<p align="center">Navn på betaler:<br></p>
<p align="center"><input type="text" name="u_payer" required><br></p>
<p align="center">Telefonnummer:<br></p>
<p align="center"><input type="text" name="u_phone" required><br></p>
<p align="center">Kontonummer:<br></p>
<p align="center"><input type="text" name="u_konto" required><br></p>
<p align="center"><input class="btn btn-success" type="submit" value="Send"><br></p>
</form>
<p align="center"><a href="help.php">Hjelp! Hva betyr alt dette ovenfor? KLIKK HER!</a></p>
</body>
</html>
<footer id="footer">
<div class="container">
<!-- footer socials -->
<div class="row">
<div class="footer_socials col-sm-12 text-center">
<div class="contact_icons">
<ul class="contact_socials clearfix">
<!-- social icons -->
</ul>
</div>
<img src="oldwebsite/assets/nb.png" width="162" height="53" class="navbar-logo-img" alt="">
<div class="copyright">Kontakt: kontakt@nattlan.net</div>
<div class="copyright">© Copyright 2017 NattLAN</div>
这是我的send.php:
<title>NattLAN - Refund</title>
<?php
require 'connection.php';
$conn = Connect();
$deltaker = $conn->real_escape_string($_POST['u_deltaker']);
$payer = $conn->real_escape_string($_POST['u_payer']);
$phone = $conn->real_escape_string($_POST['u_phone']);
$konto = $conn->real_escape_string($_POST['u_konto']);
$query = "INSERT into tb_cform (u_deltaker,u_payer,u_phone,u_konto) VALUES('" . $deltaker . "','" . $payer . "','" . $phone . "','" . $konto . "')";
$success = $conn->query($query);
if (!$success) {
die("Fail".$conn->error);
}
echo "Success";
$conn->close();
?>
这是我的connection.php:
<?php
function Connect()
{
$dbhost = "PRIVATE";
$dbuser = "PRIVATE";
$dbpass = "PRIVATE";
$dbname = "PRIVATE";
// Create connection
$conn = new mysqli($dbhost, $dbuser, $dbpass, $dbname) or die($conn->connect_error);
return $conn;
}
?>
图像格式DB显示它在两个字段中输入0:
有人可以帮我弄清楚为什么会这样吗? 谢谢:D
答案 0 :(得分:2)
我认为它插入0
因为列类型为int
?检查并更改为varchar
。