我正在将数据插入数据库,但是当我将其插入时,会创建一个空行并显示正确的行以及如何阻止此信息?我正在使用Google图表显示数据
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Name', 'Age'],
<?php
while($row = mysqli_fetch_array($result))
{
echo "['".$row["Name"]."', ".$row["Age"]."],";
}
?>
]);
var options = {
chart: {
title: 'Age Chart',
subtitle: 'Age Comparison of Site Visiters',
},
bars: 'horizontal' // Required for Material Bar Charts.
};
var chart = new
google.charts.Bar(document.getElementById('barchart_material'));
chart.draw(data, google.charts.Bar.convertOptions(options));
}
</script>
</head>
<body>
<form method="get">
First Name:<input type="text" name="Name" >
Age:<input type="text" name="Age" >
<button type="submit" name="button">Submit</button>
</form>
<?php
$Name = $_GET['Name'];
$Age = $_GET['Age'];
$sql = "INSERT INTO people (Name, Age)
VALUES('$Name','$Age');";
mysqli_query($conn,$sql);
?>