我正在嘗試在我的網站上使用此功能,由於當用戶鍵入LOAN ID時,該用戶的詳細信息將在輸入字段中回顯。php通過唯一值回顯用戶詳細信息
考慮我的數據庫有:
Id name email country zip Phone Loanid
1 kalyan [email protected] California 77777 999999 ABCDEF
所以在我的情況下,當用戶輸入的LoanID應該反響,客戶的所有領域。
我的代碼:我得到空結果通過此:
<form action="?p=show" method="post" name="details">
<div class="form-group">
<label class="col-md-3 control-label">TYPE YOUR LOAN ID:</label>
<div class="col-md-3">
<input type="text" class="form-control" name="code" required="" placeholder="Your Name"
data-bv-notempty="true"
data-bv-notempty-message="The username is required and cannot be empty"
data-bv-stringlength="true"
data-bv-stringlength-min="6"
data-bv-stringlength-max="30"
data-bv-stringlength-message="The username must be more than 6 and less than 30 characters long"
data-bv-regexp="true"
data-bv-regexp-regexp="^[a-zA-Z0-9]+$"
data-bv-regexp-message="The username can only consist of alphabetical and number"
data-bv-different="true"
data-bv-different-field="password"
data-bv-different-message="The username and password cannot be the same as each other" />
</div>
<button type="submit" id="myregister" class="btn btn-default">SHOW LOAN APPLICATION</button>
</div>
</form>
<?php
if($_REQUEST['t']=="show"){
$code=$_REQUEST['code'];
$sql = mysql_query("SELECT firstname, lastname, mobileno FROM loanapp WHERE code='$code'");
while ($row = mysql_fetch_array($sql)) {
echo $row['firstname'].'<br>';
echo $row['lastname'].'<br>';
echo $row['mobileno'].'<br>';
}
}
?>
所以我需要輸出應該是這個樣子
輸出應該是:
LoanId: ABCDEF
Firstname: kalyan E-mail: [email protected]
Country: California zipcode: 77777
Phone: 999999
SUBMIT
請幫助通過右鍵解決方案感謝提前。
所以,這些值正確地被echo'd,你想要按照你顯示它的方式來格式化它的輸出?在一個HTML表格中?這個問題是關於什麼的? – 2015-02-24 14:05:41
@ Fred-ii-我不是geeting的結果,當我點擊SHOW APPLICATION時,它只顯示Empty頁面。 – Kalyan 2015-02-24 14:18:20
'if($ _ REQUEST ['t'] ==「show」)'t「應該是一個」p「,因爲您正在執行」?p「。 – 2015-02-24 14:19:47