一个提交按钮,用于将数据从一个php函数发送到另一个


A submit button to send data from one php function to another

我正试图弄清楚如何通过使用提交按钮将数据从一个php函数发送到另一个。其想法是拼写检查器将突出显示单词的正确拼写,用户将单击按钮以使用正确拼写再次运行程序。

<form method="post" action="results.php">
    <input type="submit" value="Search!" name="submit" id="searchButton" 
           value="<?php
                      $search = "dog";
                      $_POST[$search]
                  ?>"
    />

这就是我目前所拥有的。。。

此外,按钮的值是否可能是一个变量?

您可以使用隐藏变量作为ajax的替代方案。

<input type="hidden" value="dog"  id="search" />
<input type="submit" value="Submit" />