我目前在我的最后一个项目上遇到麻烦,一种用于预订的表格没有时间输入,如何插入代码并将其与数据库集成?
这是我的预订表格代码:
<div class="a"> <b> Fill In The Appointment Form </b> </div> <br>
<hr size="3" width="50%" color="black">
<form action="pros_form_app.php" method="post" enctype="multipart/form-data" name="form1">
<br> <br> <br> <br> <br>
<table width="700" bgcolor="#FFFFFF" border="1" bordercolor="#000000" align="center" background="img/bluee.png">
<tr>
<td colspan="3" bgcolor="#3399ff"> <b> FIRST NAME </td>
<td width="10" bgcolor="#FFFFFF">:</td>
<td bgcolor="#FFFFFF"><input name="FirstName" type="text" id="FirstName" size="50" placeholder="Your First name.." /></td>
</tr>
<tr>
<td colspan="3" bgcolor="#3399ff"> <b> LAST NAME </b> </td>
<td width="10" bgcolor="#FFFFFF">:</td>
<td bgcolor="#FFFFFF"><input name="LastName" type="text" id="LastName" size="50" placeholder="Your Last name.." /></td>
</tr>
<tr>
<td colspan="3" bgcolor="#3399ff"> <b> EMAIL </b> </td>
<td width="10" bgcolor="#FFFFFF">:</td>
<td bgcolor="#FFFFFF"><input name="Email" type="text" id="Email" size="50" placeholder="Your Email.." /></td>
</tr>
<tr>
<td colspan="3" bgcolor="#3399ff"> <b> DATE </b> </td>
<td width="10" bgcolor="#FFFFFF">:</td>
<td bgcolor="#b3d9ff"><input type="Date" id="Date" name="Date" placeholder="Select a date.."></td>
</tr>
<tr>
<td colspan="3" bgcolor="#3399ff"> <b> APPOINTMENT </b> </td>
<td width="10" bgcolor="#FFFFFF">:</td>
<td bgcolor="#FFFFFF">
<select id="Appointment" name="Appointment">
<option value="health"> Premium Healthcare </option>
<option value="weight"> Weight Loss Program </option>
<option value="wrinkles"> Wrinkles and Fine Lines </option>
<option value="hair"> Hair Loss Treatment </option>
</select>
</td>
</tr>
<tr>
<td colspan="3" bgcolor="#3399ff"> <b> MESSAGE </b> </td>
<td width="10" bgcolor="#FFFFFF">:</td>
<td bgcolor="#FFFFFF"><input name="Message" type="text" id="Message" size="500" placeholder="Your Message.." /></td>
</tr>
<tr>
<td colspan="10" bgcolor="#c5e8ec" align="center">
<br>
<input name="hantar" type="submit" id="hantar" value="SUBMIT" />
<br> <br>
</td>
</tr>
答案 0 :(得分:2)
<tr>
<td colspan="3" bgcolor="#3399ff"> <b> Arrival </b> </td>
<td width="10" bgcolor="#FFFFFF">:</td>
<td bgcolor="#FFFFFF"><input name="time" type="text" id="time" size="50" placeholder="What time are you checking in?"/></td>
</tr>
在您的数据库中,如果您只需要有关时间的信息,而无需执行其他任何操作,则将其命名为varchar,因为在这种情况下,我不建议使用varchar
答案 1 :(得分:2)
尝试一下,
<tr>
<td colspan="3" bgcolor="#3399ff"> <b> DATE & Time </b> </td>
<td width="10" bgcolor="#FFFFFF">:</td>
<td bgcolor="#b3d9ff"><input type="datetime-local" id="Date" name="Date" placeholder="Select a date and time"></td>
</tr>
或
<tr>
<td colspan="3" bgcolor="#3399ff"> <b> DATE </b> </td>
<td width="10" bgcolor="#FFFFFF">:</td>
<td bgcolor="#b3d9ff"><input type="Date" id="Date" name="Date" placeholder="Select a date.."></td>
</tr>
<tr>
<td colspan="3" bgcolor="#3399ff"> <b> Time </b> </td>
<td width="10" bgcolor="#FFFFFF">:</td>
<td bgcolor="#b3d9ff"><input type="time" id="time" name="time" placeholder="Select time"></td>
</tr>
答案 2 :(得分:1)
有。我建议您在输入标签内添加required
,这意味着如果该框没有信息,则表单将不会继续,例如<input type="text" required>
<div class="a"> <b> Fill In The Appointment Form </b> </div> <br>
<hr size="3" width="50%" color="black">
<form action="pros_form_app.php" method="post" enctype="multipart/form-data" name="form1">
<br> <br> <br> <br> <br>
<table width="700" bgcolor="#FFFFFF" border="1" bordercolor="#000000" align="center" background="img/bluee.png">
<tr>
<td colspan="3" bgcolor="#3399ff"> <b> FIRST NAME </td>
<td width="10" bgcolor="#FFFFFF">:</td>
<td bgcolor="#FFFFFF"><input name="FirstName" type="text" id="FirstName" size="50" placeholder="Your First name.." /></td>
</tr>
<tr>
<td colspan="3" bgcolor="#3399ff"> <b> LAST NAME </b> </td>
<td width="10" bgcolor="#FFFFFF">:</td>
<td bgcolor="#FFFFFF"><input name="LastName" type="text" id="LastName" size="50" placeholder="Your Last name.." /></td>
</tr>
<tr>
<td colspan="3" bgcolor="#3399ff"> <b> EMAIL </b> </td>
<td width="10" bgcolor="#FFFFFF">:</td>
<td bgcolor="#FFFFFF"><input name="Email" type="text" id="Email" size="50" placeholder="Your Email.." /></td>
</tr>
<tr>
<td colspan="3" bgcolor="#3399ff"> <b> DATE </b> </td>
<td width="10" bgcolor="#FFFFFF">:</td>
<td bgcolor="#b3d9ff"><input type="datetime-local" id="Date" name="Date" placeholder="Select a date.." required></td>
</tr>
<tr>
<td colspan="3" bgcolor="#3399ff"> <b> APPOINTMENT </b> </td>
<td width="10" bgcolor="#FFFFFF">:</td>
<td bgcolor="#FFFFFF">
<select id="Appointment" name="Appointment">
<option value="health"> Premium Healthcare </option>
<option value="weight"> Weight Loss Program </option>
<option value="wrinkles"> Wrinkles and Fine Lines </option>
<option value="hair"> Hair Loss Treatment </option>
</select>
</td>
</tr>
<tr>
<td colspan="3" bgcolor="#3399ff"> <b> MESSAGE </b> </td>
<td width="10" bgcolor="#FFFFFF">:</td>
<td bgcolor="#FFFFFF"><input name="Message" type="text" id="Message" size="500" placeholder="Your Message.." /></td>
</tr>
<tr>
<td colspan="10" bgcolor="#c5e8ec" align="center">
<br>
<input name="hantar" type="submit" id="hantar" value="SUBMIT" />
<br> <br>
</td>
</tr>