小编Eri*_*ink的帖子

表单回应PHP不使用ajax提交

我有一个从数据库中回显的表单,但问题是当我尝试提交时,只有第一个回显表单提交,其余表示不提交.以下是我的代码.

editquestion.phh

<thead>
          <tr>
            <th style="width: 5%;">S/N</th>
            <th style="width: 20%;">QUESTION</th>
            <th style="width: 40%;">ANSWER</th>
            <th style="width: 30%;">KEYWORDS</th>
            <th style="width: 5%;">SAVE/UPDATE</th>
            </tr>
      </thead>
      <tbody>
        <?php
        $sql = $db->prepare("SELECT * FROM questions");
        $result = $sql->execute();

        while ($row = $result->fetchArray(SQLITE3_ASSOC))
        {
            $quiz_id = $row['quiz_id'];
            $question = $row['question'];
            $answer = $row['answer'];
            $keywords = $row['keywords'];

            echo '<form action="updatequestion.php" method="post" enctype="multipart/form-data">
            <tr>
            <td><input style="width: 50%" type="text" name="cid" id="cid" value="'.$quiz_id.'"></td>
            <td><input type="text" name="question" id="question" value="'.$question.'"></td>
            <td><input type="text" name="answer" id="answer" value="'.$answer.'"></td>
            <td><input type="text" name="keywords" id="keywords" value="'.$keywords.'"></td>
            <td><input type="submit" name="qupdate" …
Run Code Online (Sandbox Code Playgroud)

php ajax

9
推荐指数
2
解决办法
277
查看次数

使用当前范围在模板haskell中生成动态名称

我正在写一个模板haskell splice,我正在努力生成正确的Names.如果我想生成一个已知名称(比如一个函数f),我可以使用'f.这需要f在我定义拼接的范围内,而不是在它使用的地方,这正是我想要的.

现在我想要同样的东西,但对于动态名称.例如,假设我的拼接n :: Int作为一个参数.我想生成"f" ++ show n一个Name,查看splice定义站点,而不是使用站点.

我尝试了几个选项:mkName并且lookupValueName都要求名称在使用站点的范围内.单引号语法需要一个文字名称,而不是动态名称.

最后我开始尝试mkNameG.由于这些函数来自我使用它们的相同包,因此我从包名开始,但这给出了错误Can't find interface-file declaration for variable the-package-name:Some.Module.f0.在一些源读取后,我找到了使用包名称的地方"main".这似乎适用于GHCi,但在编译时我仍然得到相同的错误.

有没有办法做到这一点?我当然可以枚举所有选项,但我想避免这种情况,因为本练习的重点是使代码更具动态性.

haskell template-haskell

6
推荐指数
1
解决办法
128
查看次数

枚举resx中的所有字符串

我们想要枚举 .NET 资源文件(resx 文件)中的所有字符串。我们希望生成一个包含所有这些键值对的 JavaScript 对象。我们现在使用如下代码对卫星程序集执行此操作(这是 VB.NET,但任何示例代码都可以):

Dim rm As ResourceManager
rm = New ResourceManager([resource name], [your assembly])
Dim Rs As ResourceSet
Rs = rm.GetResourceSet(Thread.CurrentThread.CurrentCulture, True, True)
For Each Kvp As DictionaryEntry In Rs
    [Write out Kvp.Key and Kvp.Value]
Next
Run Code Online (Sandbox Code Playgroud)

然而,遗憾的是,我们还没有找到对 .resx 文件执行此操作的方法。我们如何枚举 resx 文件中的所有本地化字符串?

更新:

根据 Dennis Myren 的评论和此处的想法,我构建了一个 ResXResourceManager。现在,我可以像处理嵌入式资源一样处理 .resx 文件。这是代码。请注意,微软将所需的构造函数设为私有,因此我使用反射来访问它。使用此功能时您需要充分信任。

Imports System.Globalization
Imports System.Reflection
Imports System.Resources
Imports System.Windows.Forms

Public Class ResXResourceManager
    Inherits ResourceManager

    Public Sub New(ByVal BaseName As String, ByVal ResourceDir As String)
        Me.New(BaseName, ResourceDir, GetType(ResXResourceSet)) …
Run Code Online (Sandbox Code Playgroud)

.net javascript localization resx internationalization

5
推荐指数
1
解决办法
4920
查看次数