2013-10-17 65 views
0

我有一個形式幾個字段說更新正確的字段在數據庫

<form action="?code='.$order_id.'" method="post"> 
    <input type="text" name="length" placeholder="'.$row_order['length'].'"> 
    <input type="text" name="breadth" placeholder="'.$row_order['breadth'].'"> 
    <input type="text" name="width" placeholder="'.$row_order['width'].'"> 
    <input type="submit" name="save" value="Save"> 
</form> 

我找回長度,寬度和寬度從數據庫中的值,並顯示通過的佔位符。現在我想要如果用戶輸入一些數值,那麼只有數據庫中的長度字段纔會受到影響,而其他數據則完好無損。

現在,如果我把長度的值設置爲50並且「保存」,那麼即使在更新之前我的寬度= 40和寬度= 30,它也顯示長度= 50,寬度= 0和寬度= 0。

+1

使用價值佔位使用價值=「」不佔位=「」 – Rufinus

+0

非常感謝@Rufinus –

回答

2

而是在輸入標籤

<form action="?code='.$order_id.'" method="post"> 
<input type="text" name="length" value="'.$row_order['length'].'"> 
<input type="text" name="breadth" value="'.$row_order['breadth'].'"> 
<input type="text" name="width" value="'.$row_order['width'].'"> 
<input type="submit" name="save" value="Save"> </form> 
+0

感謝@Aman它的工作。 –

相關問題