2011-05-08 33 views
-2

如何用相應的數據填充多個文本輸入字段,只執行一次php-mysql查詢腳本? 例如jquery php json示例

<form name="video" action="mysql.php" method="post" enctype="multipart/form-data" target="videofrm"> 
       <p> 
        <label for="url">url/gallery:</label><input class="text" type="text" id="url" name="url"/> 
        <input id="favorite" class="text" type="checkbox" name="favorite" value="true"/> 
        <label for="favorite" class="noneFloat">favorite</label> 
       </p> 
       <p> 
        <input id="thumb" type="file" name="thumb"/> 
       </p> 
       <p> 
        <label for="title">title:</label><input class="text" type="text" id="title" name="title"/> 
       </p> 
       <p> 
        <label for="desc">description:</label><input class="text" type="text" id="desc" name="description"/> 
       </p> 
       <p> 
        <label for="country">country:</label><input class="text" type="text" id="country" name="country"/> 
       </p> 
       <p> 
        <label for="categories">categories:</label><input class="text" type="text" id="categories" name="category"/> 
       </p> 
       <input type="button" value="fetch" id="fetch"/> 
       <input type="reset" value="clear"/> 
      </form> 

我需要填充與輸入文本字段:

select url,title,desc,country,category 
from video where url='something'; 

首先,我需要知道如何使返回JSON數據類型寫這種PHP腳本,事後如何填充文本輸入字段,使用jQuery,並返回數據。

`非常感謝

+0

這需要大量的澄清才能負責。你問如何填充數據庫值的文本輸入? – 2011-05-08 12:11:15

+0

什麼部分不清楚給你?它說php-mysql查詢腳本,這當然不是來自我的日記夥計。當然這是一個有問題的數據庫。 – 2011-05-08 12:17:14

+0

你知道任何PHP或JavaScript嗎?如果沒有,閱讀一些教程將是一個好的開始。我們不會只爲你做你的工作...... – 2011-05-08 12:46:49

回答

3

你提的問題是非常廣泛的,看起來有點像「請寫出我的代碼」請求(雖然它不一定是一個)。儘量避免這種印象,並提及你已經嘗試/研究的內容,以避免投降。

一些指針:

+0

非常感謝。這就是我需要的一切,快速的方向。畢竟,我們都是不同的,有自己的表達方式。因爲我們正在編寫應用程序來處理這種複雜的判斷,所以我們不應該忘記將它集成到我們自己的想法中。 – 2011-05-08 13:07:52