php code
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;
}
}
This is html form
<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>
What is the error in logic??
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?
this is my database entering query
$insert = "INSERT INTO dbform (dblocation) VALUES ('{$choice_loc}')";
There is no way your test can enter the third choice :
Because
covers all the possible paths and could be replaced by
where you would have seen that you couldn’t add another test case.
Maybe you should try to invert the order in your test :