如何使用下拉列表中的信息填写表单数据 [英] How do I..fill form data with information from a dropdown

查看:69
本文介绍了如何使用下拉列表中的信息填写表单数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在页面上有一个用户可以保存信息的表单,以及一个从他们保存的目录中提取这些已保存文件的下拉列表。我想要的是当他们去那个页面时,是当他们从下拉框中选择文件名时,它将文件的名称放在输入框CodeDescription字段中,并将文件信息放在textareaCode中,但我不确定如何解析它。以下是我目前的代码。

I have a form on a page where users can save information, and a dropdown that pulls those saved files from the directory they saved them to. What I would like is when they go to that page, is that when they select the filename from the dropdown box, it places the name of the file in the input box "CodeDescription" field and the information on the file in the textarea "Code" , however I am unsure how to go about parsing that. Below is my current code.

<input type="hidden" name="Action" value="EDIT" /><input type="hidden" name="Selection"  id="Selection" value="-1"><div>Below is the list of your saved codes. To edit your codes, select it from the list.</div>
<select> 
<?php <br mode="hold" /?>    $directory = $directory = 'users/' . $_SESSION['username'];

$files = scandir( $directory ) ;

foreach( $files as $file )
{
if ( ! is_dir( $file ) )
{
echo "<option>" . $file . "</option>";
}
}
?>
</select>
        <h3>Saved Codes</h3>


        <form method="post" action="/evo/avsaveprocess.php">

            <input type="hidden" name="Action" value="SAVE" />
            <input type="hidden" name="CodeId" id="CodeId" value="0" />
            <table width="100%" border="0">

                <tr>
                    <td>Description:</td>
                    <td><input type="text" name="CodeDescription" size="40" maxlength="50" id="CodeName" value="" /></td>
                </tr>

                <tr>
                    <td valign="top">Code:</td>
                    <td>
                        <textarea rows="10" style="width:99%" name="Code" id="CodeValue"></textarea>
                    </td>
                </tr>

            </table>

            <input type="submit" value="Save" />
            </form>









已添加标签。

[/编辑]

推荐答案

directory =
directory =


directory ='users /'。
directory = 'users/' .


_SESSION ['username'];
_SESSION['username'];


这篇关于如何使用下拉列表中的信息填写表单数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆