php代码
if(isset($_POST['txtLocation']))
{
$choice_loc = $_POST["txtLocation"];
}
elseif(!isset($_POST['txtLocation']))
{
$message = "Please select the desired location or click on default";
}
elseif($choice_loc == "txtSetXY")
{
$x = $_POST["txtXLocation"];
$y = $_POST["txtYLocation"];
if($x == "")
{
$message = "You forget to enter X location.";
}
elseif($y == "")
{
$message = "You forget to enter Y location.";
}
else
{
$choice_loc = $x . "," . $y;
}
}
这是html表单
<div class="formText">
<input type="radio" name="txtLocation" value="txtSetXY"/> Specify Location<br />
<div style="padding-left:20px;">
X: <input type="text" id="locField" name="txtXLocation">
Y: <input type="text" id="locField" name="txtYLocation">
</div>
<input type="radio" name="txtLocation" value="Default" checked="checked"/>Default
</div>
逻辑有什么错误??
value "default" is entered into database, but when selected value="txtSetXY"
radio and entering x and y values in textfields it is not entering into database?
这是我的数据库输入查询
$insert = "INSERT INTO dbform (dblocation) VALUES ('{$choice_loc}')";