PHP代碼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="txtSetXY"
無線電並在文本字段中輸入x和y值時,它不會進入數據庫?
,這是我的數據庫中輸入查詢
$insert = "INSERT INTO dbform (dblocation) VALUES ('{$choice_loc}')";
它停在第二個if語句處。 – rlatief
@ user543732我們可以使用任何類型的PHP開發平臺,在這裏我們可以檢查我們的編碼或幹運行,就像我們在turboC編譯器中的c和C++一樣?這樣可以很容易地輸出結果和錯誤? – Sumit
有幾個,但我不知道他們中的任何一個是否可以捕獲這種錯誤。 '如果A' - 做A.' elseif不A''做B。它停在那裏,永遠不會到達它下面的每個'elseif'和'else'。正如你所說的一個邏輯錯誤,而不是PHP語法。 – rlatief