【问题标题】:jquery php json example [closed]jquery php json示例[关闭]
【发布时间】:2011-05-08 12:03:52
【问题描述】:

如何用相应的数据填充几个文本输入字段,只执行一次 php-mysql 查询脚本? 例如

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

首先我需要知道如何编写这种 php 脚本以便它返回 json 数据类型,然后如何使用 jquery 填充文本输入字段并返回数据。

`非常感谢

【问题讨论】:

  • 这需要大量澄清才能得到解答。您是在问如何从数据库值中填充文本输入?
  • 您不清楚哪一部分?它说的是 php-mysql 查询脚本,它肯定不是来自我的日记花花公子。当然这是一个有问题的数据库。
  • 你知道 PHP 或 JavaScript 吗?如果没有,阅读一些教程将是一个好的开始。我们不会只为你做你的工作......
  • @atno - 我已经让你振作了一点:)

标签: php javascript jquery mysql json


【解决方案1】:

您的问题非常广泛,看起来有点像“请写我的代码”请求(尽管不一定是)。尽量避免这种印象,并提及您已经尝试/研究过的内容以避免投反对票。

一些提示:

【讨论】:

  • 非常感谢。这就是我所需要的,一些快速的方向。毕竟,我们都是不同的,都有自己的表达方式。当我们编写应用程序来处理这种复杂的判断时,我们不应该忘记将其整合到我们自己的脑海中。
猜你喜欢
  • 2012-10-11
  • 2016-05-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多