-2

How do I populate several text input fields with corresponding data, executing php-mysql query script once only? e.g.

<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>

I need to populate input text fields with:

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

First I need to know how to write this kind of php script so it returns json datatype, and afterwards how to populate text input fields, using jquery, with returned data.

`many thanks

Wesley Murch
  • 101,186
  • 37
  • 194
  • 228
daniel.tosaba
  • 2,503
  • 9
  • 36
  • 47
  • This needs a good deal of clarification in order to be answerable. Are you asking how to populate text inputs from database values? – Wesley Murch May 08 '11 at 12:11
  • what part is not clear to you? it says php-mysql query script, it is for sure not from my diary dude. of course it is a database in question. – daniel.tosaba May 08 '11 at 12:17
  • Do you know any PHP or JavaScript? If not, reading some tutorials would be a good start. We will not just do your work for you... – Felix Kling May 08 '11 at 12:46
  • 2
    You might want looking at http://api.jquery.com/category/ajax/ and http://php.net/manual/en/function.json-encode.php and http://php.net/manual/en/book.mysql.php. – pimvdb May 08 '11 at 12:47
  • @atno - I've boost you up a little bit :) –  May 08 '11 at 12:48
  • @Felix Kling: of course i know. i just need json part to be explained. many thanks – daniel.tosaba May 08 '11 at 12:49
  • @daniel: Well, you didn't post any PHP or JavaScript code, so we cannot know... – Felix Kling May 08 '11 at 12:51
  • @pimvdb: thanks, that is very valuable info – daniel.tosaba May 08 '11 at 12:52
  • @Felinx: i didn't want to bother you guys with one pdo query, as well with one jquery ajax call. but i do know this thing, just need brief json part demonstration. leave out all event handlers ands stuff, just pure json manipulation – daniel.tosaba May 08 '11 at 12:54

1 Answers1

3

Your question is very broad, and looks a bit like a "please write my code" request (although it wasn't necessarily one). Try to avoid that impression, and mention what you have already tried/researched to avoid downvoting.

Some pointers:

Community
  • 1
  • 1
Pekka
  • 442,112
  • 142
  • 972
  • 1,088
  • many thanks. that is all i needed, some quick direction. after all, we are all different and have our own ways of expressing ourselves. as we are writing apps to deal with this kind of sophisticated judging we shouldn't forget integrated it within our own mind. – daniel.tosaba May 08 '11 at 13:07