我有以下内容:
<form action="file.php" method="post" enctype="multipart/form-data" name='form' id='form'>
<table border="0" cellpadding="0" cellspacing="0" width="100%" align="center" style="BORDER-RIGHT: #fe03b4 1px solid; BORDER-TOP: #fe03b4 1px solid; BORDER-LEFT: #fe03b4 1px solid; BORDER-BOTTOM: #fe03b4 1px solid">
<tr>
<td style="margin-left: 3px">
<b><font color="#f803f8" size="1">Eyes</font></b>
</td>
<td>
<select size="1" name="eyes" class="input" id="eyes" style="BACKGROUND-COLOR: #f7ed79; COLOR: #000000; font-family: Arial; font-size: 10px; width:150px;">`
<option selected="selected" value="">Select</option>
<option value="1"<? if ($eyes=="1") echo "selected"; ?>>Blue</option>
<option value="2"<? if ($eyes=="2") echo "selected"; ?>>Green</option>
</select>
</td>
</tr>
</table>
<br />
<table border="0" cellpadding="0" cellspacing="0" width="100%" align="center" style="BORDER-RIGHT: #fe03b4 1px solid; BORDER-TOP: #fe03b4 1px solid; BORDER-LEFT: #fe03b4 1px solid; BORDER-BOTTOM: #fe03b4 1px solid">
<tr>
<td style="margin-left: 3px">
<b><font color="#f803f8" size="1">Description</font></b>
</td>
<td>
<textarea rows='5' name='description' cols='120'><? echo "$description"; ?></textarea>
</td>
</tr>
</table>
<br />
<table width="100%" border="0" align="center">
<tr>
<td align="center">
<input name='Update' type='submit' onClick="if(document.form.eyes.value == ''){ alert('Eyes Color?'); document.form.eyes.focus(); return false; } else
if(document.form.description.value==''){ alert('Description?'); document.form.description.focus(); return false; } else
{ document.form.submit(); parent.scrollTo(0,0); }" value='Update' style="width:100%; font-size:10px" />
</td>
</tr>
</table>
</form>
第一个警报(眼睛)有效,但第二个没有给我警报,即使没有插入文本,它也会保存。
数据库中的 EYES 列定义为 0,然后我可以选择选项 1 或 2 进行更新。
如果没有以前的保存,数据库中的文本字段可以更新吗?换句话说,数据库中的文本列是 NULL(没有保存文本),我尝试在没有保存的情况下进行更新。
这里有什么帮助吗?