在会话帖子中传递隐藏的表单数据

时间:2014-02-25 20:17:57

标签: php webforms

我必须将此表单提交到PHP页面上的支付处理网关。所有信用卡支付信息都将在下一个屏幕上显示,但网关需要“HostedKey”,并且“Gateway_ID”也需要在公共代码视图中不可见。

<form action="nextpage.php" method ="POST" target="_blank">
Patient Account Number:
<input type="text" name="CustRefID" id="CustRefID">

<input type="hidden" name="HostedKey" id="HostedKey" value="ZZZZZZ" />
<input type="hidden" name="Gateway_ID" id="Gateway_ID" value="XXXXXX" />

<input type="hidden" name="IndustryCode" id="IndustryCode" value="2" />
<input type="hidden" name="Amount" id="Amount" value="" />
<input type="hidden" name="RecurringType" id="RecurringType" value="N" />
<input type="hidden" name="RecurringAmount" id="RecurringAmount" value="" />
<input type="hidden" name="CURL" id="CURL" value="back to my site" />
<input type="hidden" name="AVSRequired" id="AVSRequired" value="Y"/>
<input type="hidden" name="CVV2Required" id="CVV2Required"value="Y"/>
<input type="hidden" name="EmailRequired" id="EmailRequired" value="Y"/>
<input type="hidden" name="PostRspMsg" id="PostRspMsg" value="Y"/>
<input type="hidden" name="SECCode" id="SECCode"  value="1" />
<input type="hidden" name="Descriptor" id="Descriptor" value="Online" />
<input type="Submit" name="Submit" id="Submit" value="Pay Online Now" />
</form>

我试过这样的事情。它隐藏了Key和ID,但表单没有传递隐藏的会话变量。

<strong>Patient Account Number: </strong>
<form action="nextpage.php" method"post">
<input type="text" name="CustRefID"/>
<input type="hidden" name="HostedKey" id="HostedKey" value="" />
<input type="hidden" name="Gateway_ID" value="<?php ($Gateway_ID); ?>" />
<input type="hidden" name="HostedKey" value="<?php ($HostedKey); ?>" />
<input type="submit" name="Submit" value="Submit" />
</form>

<?php
if (isset($_POST['Submit'])) 
{ $_session['CustRefID'] = $_POST['CustRefID'];} 
{ $_session['HostedKey'] = $_POST['xxxxxx'];} 
{ $_session['Gateway_ID'] = "zzzzzz";} 

?> 

<strong><? echo $_session['CustRefID'];?></strong>

任何帮助都会很棒。我的程序员病了...

1 个答案:

答案 0 :(得分:1)

  1. 您的HTML中有重复。改为:
  2. <input type="hidden" name="Gateway_ID" value="<?php ($Gateway_ID); ?>" /> <input type="hidden" name="HostedKey" value="<?php ($HostedKey); ?>" /> 2.您没有指定在SESSION中应该传递哪些POST信息。把它改成这个: { $_SESSION['CustRefID'] = $_POST['CustRefID']; $_SESSION['HostedKey'] = $_POST['HostedKey']; $_SESSION['Gateway_ID'] = $_POST['HostedKey']; }