看一些教程我已經添加了單選按鈕,但由於某些原因,它無法正常工作。當我提交表單的值不輸入到數據庫中單選按鈕不工作
這裏是我的代碼 情況下的「添加」:
if($_POST['addbtn'] == 'Save')
{
$name = '';
if(isset($_REQUEST['name']))
{
$name = $_REQUEST['name'];
}
$imageName = '';
$field = 'banner_images';
if($_FILES[$field ]['error'] == 0)
{
if($_FILES[$field]['tmp_name'] != '')
{
$uploaddir = "../inner_page_banner_images/";
$banner_images = $_FILES[$field]['name'];
$tag = "";
$Twidth = 980;
$Theight = 420;
@move_uploaded_file($_FILES[$field]['tmp_name'],$uploaddir.$_FILES[$field]['name']);
}
$site = '';
if(isset($_REQUEST['site']) == 'hino')
{
$site = $_REQUEST['checked'];
}
elseif(isset($_REQUEST['site']) == 'storm')
{
$site = $_REQUEST['checked'];
}
}
//--------------------------------------------------------------------------------------------------------
$Query = "INSERT INTO inner_banner SET ";
$Query .= "name = '".$name."',";
$Query .= "banner_images = '".$banner_images."'";
$Query .= "site = '".$site."'";
//echo $Query; die();
mysql_query($Query);
$_SESSION['msg'] = " New banner image uploaded successfully ";
@header("Location: inner_banner.php? module=inner_banner&action=view");
die();
}
include "add_banner.php";
break;
我的HTML代碼
<form method="post" name="frm1" id="frm1" action="" autocomplete="off" enctype="multipart/form-data" onsubmit="return ValidateForm(this);" >
<table cellspacing="0" cellpadding="3" border="0" align="center" width="100%">
<tr>
<td width="18%">Banner Title</td>
<td width="1%">:</td>
<td><input type="text" name="name" id="name" size="40" value="" />
<span class="required">*</span> </td>
</tr>
<tr>
<td colspan="3" style=" background-color: #FFFFFF;"> </td>
</tr>
<tr>
<td valign="top">Banner Image </td>
<td valign="top">:</td>
<td><input type="file" name="banner_images" id="banner_images" size="20" />
</td>
</tr>
<tr>
<td colspan="3" style=" background-color: #FFFFFF;"> </td>
</tr>
<tr>
<td valign="top">Select:</td>
<td valign="top">:</td>
<td><input type="radio" value="hino" name="site" id="site" />
HINO
<input type="radio" value="storm" name="site" id="site" />
Storm
<span class="required">*</span>
</td>
</tr>
<tr>
<td colspan="3" style=" background-color: #FFFFFF;"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="addbtn" value="Save" />
<input type='button' value='Cancel' onclick="document.location.href='inner_banner.php?module=inner_banner'" />
<input type="hidden" name="Validation" id="Validation" value="
Field=name|Alias=Banner Title|Validate=BLANK^
Field=banner_images|Alias=Banner Image|Validate=BLANK" />
可以somebosy請看看它爲什麼數值未進入數據庫
感謝大衛我會loolk進去,但RightNow的我第一次想讓我的單選按鈕工作當中不工作,所以你可以幫助我在那 –
是不是你的問題?你的單選按鈕有什麼問題?如果你的sql語句中缺少一個逗號,你的查詢就會失敗 - 無論你的單選按鈕是什麼或沒有做什麼)。 –
感謝lotttttt大衛它爲我工作。再次感謝 –