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}')";
ifstatement.if A- do A.elseif not A- do B. It stopped right there, will never reach everyelseifandelsebelow it. It's as you said a logic error, not PHP syntaxes.php file.phpwill run the file and give an output or even just browse to the page. To debug, put echo/print lines to determine where your script is going.