首先,我想建议它更好地创建自己的模块或组件,然后使用mod_html。 mod_html不适用于表单提交。无论如何,如果你仍然想继续,那么你可以在Joomla内创建一个文件夹例如。 “custom”并将php文件HereYouGo.php放入文件夹中。在你的表单中通过custom/HereYouGo.php替换HereYouGo.php。假设你已经安装了源代码插件。所以你的形式看起来像
{source}
<!-- You can place html anywhere within the source tags -->
<form action="custom/HereYouGo.php" method="post"><center><input name="fullname" required="" size="25" type="text" placeholder="Full Name" /> <input name="email" required="" size="25" type="text" placeholder="Email" /> <input name="psw" required="" size="25" type="password" placeholder="Password" /></center><br /> <input type="submit" value="Here You Go!" /><br /><br /><center>
<h4>By clicking "Here You Go!" you agree with our terms & conditions and private policy.</h4>
</center>
<script language="javascript" type="text/javascript">
// You can place JavaScript like this
</script>
<?php echo JHtml::_('form.token'); ?>
</form>
{/source}
JHTML :: _( 'form.token')是为了避免CSRF攻击(跨站请求伪造)
现在,在你的PHP只是检查的形式标记然后继续你想做的事情。保存在数据库等或重定向到另一个页面。典型的PHP脚本应该有这些代码正常工作,因为它是一个外部脚本
//Codes for accessing Joomla classes through external script
define('_JEXEC', 1);
define('JPATH_BASE', realpath(dirname(__FILE__).'/..'));
require_once (JPATH_BASE. '/includes/defines.php');
require_once (JPATH_BASE. '/includes/framework.php');
$mainframe = JFactory::getApplication('site');
$mainframe->initialise();
//Codes for accessing Joomla classes Ends
$session = JFactory::getSession();
$session->checkToken() or die('Invalid Token'); //Check for form submission forgery
// Instantiate the application.
// Your code starts from here
var_dump($_POST);
这不是你的问题的答案。但我只是想让我知道'
感谢您的更新......它仍然工作,虽然 –