簡體   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