0

我有一个正在编写的脚本,但我遇到了一个问题。我无法从保管箱获取信息以提交到 MySQL 数据库。

除 Dropbox 中的项目外,所有内容都将显示在数据库中。

这是我的代码:

<form action="work.php" method="post">


<table>
<tr>
<td>Email:</td>
<td><input type="text" name="Email" tabindex="1" />
</td>
</tr>

<tr>
<td>Messgae:</td>
<td><textarea name="Message" 
rows = "7"
cols = "35"
tabindex = "2" /></textarea>
</td>
</tr>


<tr>
<Td>Time</td>

<td>
<select name="hour" tabindex="3">
<option value="1">1AM</option>
<option value="2">2AM</option>
<option value="3">3AM</option> 
<option value="4">4AM</option>
<option value="5">5AM</option>
<option value="6">6AM</option>
<option value="7">7AM</option>
<option value="8">8AM</option>
<option value="9">9AM</option>
<option value="10">10AM</option>
<option value="11">11AM</option>
<option value="12">12PM</option>
<option value="13">1PM</option>
<option value="14">2PM</option>
<option value="15">3PM</option>
<option value="16">4PM</option>
<option value="17">5PM</option>
<option value="18">6PM</option>
<option value="19">7PM</option>
<option value="20">8PM</option>
<option value="21">9PM</option>
<option value="22">10PM</option>
<option value="23">11PM</option>
<option value="24">12AM</option>
</select><br>
<input type="submit" name="formSubmit" value="Submit" >
</form>

然后是 work.php

<?php
$time = $_POST['hour'];
$email1 = $_POST['Email'];
$message1 = $_POST['Message'];

mysql_connect ('localhost', 'myuser', 'mypassword') or die ('Error: ' .mysql_error());
mysql_select_db ("mydatabase");

$query="INSERT INTO Reminder (Email, Message, Time)
VALUES
('$email1','$message1','$time')";
mysql_query($query) or die ('Error submitting');

echo "You Chose: " .$time ;

?>
4

0 回答 0