繁体   English   中英

将表单数据提交到php文件,但在不同页面上查看相同结果

[英]Submit form data to php file but view same results on different page

我正在尝试将表单数据发送到php文件进行处理-但我需要在用户点击提交后加载的单独页面上显示相同信息。

我正在尝试创建条形码扫描搜索工具。 用户将条形码扫描到文本框中,然后提交数据以查询sql服务器。 我正在使用PDO查询,该网站是内部网站,该工具仅可供4个人使用-因此,我不必担心SQL注入。 它不是那么复杂的工具,但是使用这种聪明的模板是一件很痛苦的事情。

我不能简单地将嵌套的php代码放在同一页面上,因为该站点正在使用此Smarty模板引擎。

基本上,我的php处理文件是在results.tpl页面上调用的插件中调用的。

results.php-> results.tpl-> function.scanplugin-> php_processing_file(handler.php)

我收到一个未知错误或“提交”按钮不起作用。 我可以提供更多详细信息,只是想保持简短...

用户可以在下面的Scan.tpl文件中扫描并提交条形码。

有任何想法吗?

{include file='globalheader.tpl'}
<h1>Barcode Scanning Tool</h1>

<script type="text/javascript">
function resultsview() {
window.location = "results.php";
return false;
}
</script>

<div id="help">
<h3>Scan a barcode and hit SUBMIT</h3>

<br /><br />

<form action="handler.php" onsubmit="return resultsview()" method="post">
<input type="number" name="barcode" value="1" />
<input type="submit" value="Submit" name="submit" />
</form >

</div>

 {include file='globalfooter.tpl'}

我猜,从您的代码来看,后数据无处发送,因为js获得了动作,并且仅将其重定向到results.php,而没有后数据。 我认为您必须从handler.php重定向它。 对不起,我的英语不好:

暂无
暂无

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

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