[請益] 如何將MySql資料放入Form裡面呢?

看板PHP作者 (翻滾吧!大貓)時間15年前 (2011/02/09 13:21), 編輯推噓3(303)
留言6則, 4人參與, 最新討論串1/1
我做了一個簡單的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

02/09 13:50, , 1F
為什麼要echo出html碼啊
02/09 13:50, 1F

02/09 13:59, , 2F
不太懂意思 弄個url ? get ?
02/09 13:59, 2F

02/09 14:35, , 3F
會不會是說 在欄位後+個按鈕 點按鈕就載入該數值?
02/09 14:35, 3F

02/09 14:36, , 4F
你應該不會是用smarty架構 然後全用echo 顯示?
02/09 14:36, 4F
※ 編輯: hiasdasz 來自: 122.121.26.61 (02/09 16:36) ※ 編輯: hiasdasz 來自: 122.121.26.61 (02/09 16:40)

02/09 16:39, , 5F
php也可以直接寫網頁,真是奇怪
02/09 16:39, 5F

02/09 17:20, , 6F
同樓上~XD 你可以把echo 拿掉的
02/09 17:20, 6F
文章代碼(AID): #1DKYG-5Z (PHP)
文章代碼(AID): #1DKYG-5Z (PHP)