我创建了一个包含20个问题的html表单,它们是文本和收音机类型,收音机类型问题具有名称值,这就是答案,例如
How old are you?
* 200 (value="200")
* 300 (value="300")
* 400 (value="400")
然后,当表单被提交时,它将人,即提交的表单转换为页面,将所有数据插入数据库,但在0秒内使用元标记即可将用户转到最后一页,结果,在那里他可以看到所有答案,这里是例子http://prnt.sc/a8hvp0(Jautajums =问题),答案全都下来。
我想知道如何插入我的代码脚本或检查答案的内容,如果它们是正确的,那么在创建表格时,他会为这些答案制作绿色背景,这是正确的
=============================================== ====================
<?php
define('DB_NAME', '');
define('DB_USER', '');
define('DB_PASSWORD', '');
define('DB_HOST', '');
$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
if(!$link)
{
die ('Could not Connect: ' . mysql_error());
}
$db_selected = mysql_select_db(DB_NAME, $link);
if(!$db_selected)
{
die('can\'t use ' . DB_NAME . ': ' .mysql_error()) ;
}
echo "Hippy Nanny noo";
$value2 = $_POST['example'];
$value3 = $_POST['example12'];
$value4 = $_POST['example123'];
(Here are more of them)
$sql = "INSERT INTO form (example, example12, example123) Values ('$value2', '$value3', '$value4')";
if (!mysql_query($sql))
{
die('Error: ' . mysql_error());
}
mysql_close();
?>
=============================================== ===========
<?php
$con=mysqli_connect('','','','');
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM form");
echo "<table border='1'>
<tr>
<th>Example</th>
<th>Example12</th>
<th>Example123</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['example'] . "</td>";
echo "<td>" . $row['example12'] . "</td>";
echo "<td>" . $row['example123'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?>