看板 PHP 關於我們 聯絡資訊
我做了一個簡單的FORM,可以寫入至資料庫 類似這樣: echo "<form method='POST'>"; echo "<table border=1> <tr> <td><input name='name1' type='text'></td> <td><input name='name2' type='text'></td> </tr> <tr> <td><input name='name3' type='text'></td> <td><input name='name4' type='text'></td> </tr> </table>"; echo "<input type=submit name='abc' value='存檔'>"; echo "</form>"; 已經完成將表單裡的資料寫入mysql 目前想要在使用者重新整理網頁,或開啟網頁時 網頁直接讀取資料庫裡的資料,並放在input裡面呢? 想加個讀取按鈕,並放在可輸入資料的欄位裡 麻煩各位大大幫我解答>< 我已經解決了... 因為程式寫在*.php檔,要用網頁呈現 所以才會用echo方式 我是用這種方式解決的 mysql_select_db("mysql_db", $con); $result1 = mysql_query("select * from user"); $row1 = mysql_fetch_array($result1); . . . echo "<td><input name='name1' type='text' value='".$row1['name1']."'></td>"; . . . -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 122.121.26.61
rocairforce:為什麼要echo出html碼啊 02/09 13:50
twsphere:不太懂意思 弄個url ? get ? 02/09 13:59
kuAIpAI:會不會是說 在欄位後+個按鈕 點按鈕就載入該數值? 02/09 14:35
kuAIpAI:你應該不會是用smarty架構 然後全用echo 顯示? 02/09 14:36
※ 編輯: hiasdasz 來自: 122.121.26.61 (02/09 16:36) ※ 編輯: hiasdasz 來自: 122.121.26.61 (02/09 16:40)
knives:php也可以直接寫網頁,真是奇怪 02/09 16:39
kuAIpAI:同樓上~XD 你可以把echo 拿掉的 02/09 17:20