简体   繁体   English

单击超链接或按钮是否可以将其他HTML表单加载到页面上?

[英]Is it possible to load a different HTML form onto a page by clicking a hyperlink or button?

I have a number of different php-forms(25) that will handle some information. 我有许多不同的php-forms(25)可以处理一些信息。 Instead of creating a different page for each of those forms, is it possible to be able to load a different form on the page just by selecting something from a list or hyper-link? 不必为每个表单创建不同的页面,而是仅通过从列表或超链接中选择内容就可以在页面上加载不同的表单吗?

For example: 例如:

If I want to use form A then I click the link or button for form A, which then appears on the page when it reloads. 如果要使用表格A,请单击表格A的链接或按钮,表格A会在重新加载时显示在页面上。

Let me know if you need me to explain it to you better lol. 让我知道您是否需要我更好地向您解释。

I want it to work the same way that this website does, you click the hyperlink and a different form appears. 我希望它的工作方式与本网站相同,请单击超链接,然后出现另一种形式。

you can have the links that you click to select forms have GET variables attached to them, so that when the page reloads, you can use those variables to determine which form to show. 您可以单击链接以选择表单,这些链接上附加了GET变量,以便在重新加载页面时可以使用这些变量来确定要显示的表单。 eg: 例如:

<a href="thispage.php?form=a">form a</a>
<a href="thispage.php?form=b">form b</a>
<a href="thispage.php?form=c">form c</a>

<?
switch ($_GET['form'])
{
    case 'a':
        ?>
        <form method="POST" action="thispage.php">
            <!-- form a elements here :) -->
        </form>
        <?
        break;
    case 'b': // show form b
        ?>
        <form method="POST" action="thispage.php">
            <!-- form b elements here :) -->
        </form>
        <?
        break;
    case 'c': // show form c
        ?>
        <form method="POST" action="thispage.php">
            <!-- form c elements here :) -->
        </form>
        <?
        break;
}
?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM