从MySQL创建HTML页面以发送到chromecast?

时间:2017-06-28 02:46:44

标签: php html mysql chromecast

我创建了一个表单来提交和存储在MySQL数据库中,一切都很顺利。我想通过获取两行来获取该数据并创建一个静态HTML页面。然后可以通过Chromecast接收HTML页面并将其显示在电视监视器上。

我的问题在于弄清楚如何制作静态HTML页面。我似乎找不到任何可以按照我想要的方式工作的东西,到目前为止还没有能够提出任何工作。我很感激任何帮助或指向正确的方向。

HTML表单

<html>
<head>
<title> Screen </title>
</head>
<body>
<h3> Screen Display Information</h3>
<form action="thankyou.php" method="post">
  Project Number:<br>
  <input type="text" name="project_number" required><br>
 
  Customer Name:
  <input type="text" name="customer_name" required><br>
 
Machine Type:<br>
  <input type="text" name="machine_type" required><br>
 
Bay Number:<br>
  <select name="bay_number" required>
	<option value="bay1">Bay 1</option>
	<option value="bay2">Bay 2</option>
	<option value="bay3">Bay 3</option>
	<option value="bay4">Bay 4</option>
	<option value="bay5">Bay 5</option>
  <option value="bay6">Bay 6</option>
  </select><br>
  
<input type="submit" value="Submit"><br>
</form>
</body>
</html>

PHP保存为thankyou.php

<?php

 
require 'connection.php';
$conn    = Connect();


$project_number    = $conn->real_escape_string($_POST['project_number']);
$customer_name   = $conn->real_escape_string($_POST['customer_name']);
$machine_type    = $conn->real_escape_string($_POST['machine_type']);
$bay_number = $conn->real_escape_string($_POST['bay_number']);
$query   = "INSERT into tb_bayform (project_number,customer_name,machine_type,bay_number) VALUES('" . $project_number . "','" . $customer_name . "','" . $machine_type . "','" . $bay_number . "')";
$success = $conn->query($query);
 
if (!$success) {
    die("Couldn't enter data: ".$conn->error);
 
}
 
echo "Thank you, your changes have been recorded <br>";

 
$conn->close();
 
?>

0 个答案:

没有答案