[英]Hide a form in a div and show it only after redirect
我有一個可以與Joomla組件一起使用的表單,該組件已經過大量修改。 現在,我還要在表單之前添加付款集成。 我計划在成功從Payment重定向后將頁面上的申請表隱藏起來,然后僅顯示它。 我該怎么辦? 代碼: 申請表
<!-- Hide this agent form until page redirect(successful payment) -->
<?php if($this->agent){ ?>
<section id="contact-agent">
<header><h2>APPLY FOR THIS DESIGN</h2></header>
<div class="row">
<section id="contact-agent">
<header><h2>APPLY FOR THIS DESIGN</h2></header>
<div class="row">
<section class="agent-form">
<div class="col-md-5 col-sm-12">
<div class="agent-form">
<form role="form" id="form-contact-agent" method="post" action="<?php echo JRoute::_("index.php?option=com_bt_property"); ?>" class="clearfix">
<div class="form-group">
<label for="form-contact-agent-name"><?php echo JText::_('COM_BT_PROPERTY_YOUR_NAME');?><em>*</em></label>
<input type="text" class="form-control2" id="form-contact-agent-name" name="name" value="<?php echo $this->user->name; ?>" required>
</div><!-- /.form-group -->
<div class="form-group">
<label for="form-contact-agent-email"><?php echo JText::_('COM_BT_PROPERTY_YOUR_EMAIL');?><em>*</em></label>
<input type="email" class="form-control2" id="form-contact-agent-email" name="email" value="<?php echo $this->user->email; ?>" required>
</div><!-- /.form-group -->
<div class="form-group">
<label for="form-contact-agent-phone"><?php echo JText::_('COM_BT_PROPERTY_YOUR_PHONE');?><em>*</em></label>
<input type="text" class="form-control2" id="form-contact-agent-phone" name="phone" value="<?php echo $this->user->phone; ?>" required>
</div><!-- /.form-group -->
<div class="form-group">
<label for="form-contact-agent-location"><em>Your Current Location*</em></label>
<input type="text" class="form-control2" id="form-contact-agent-location" name="location" value="<?php echo $this->user->location; ?>" required>
</div><!-- /.form-group -->
<div class="form-group">
<label for="form-contact-agent-proposed-location"><em>Proposed Property Location*</em></label>
<input type="text" class="form-control2" id="form-contact-agent-proposed-location" name="proposedlocation" value="<?php echo $this->user->proposedlocation; ?>" required>
</div><!-- /.form-group -->
<div class="form-group">
<label for="form-contact-agent-docs"><em>What documents are you applying for?*</em></label><br/>
<input type="checkbox" class="form-control" name="ArchitecturalDrawing" value="<?php echo $this->user->ArchitecturalDrawing; ?>" />Architectural Drawing<br/>
<input type="checkbox" class="form-control" name="StructuralDrawing" value="<?php echo $this->user->StructuralDrawing; ?>" />Structural Drawing<br/>
<input type="checkbox" class="form-control" name="MechanicalDrawing" value="<?php echo $this->user->MechanicalDrawing; ?>" />Mechanical Drawing<br/>
<input type="checkbox" class="form-control" name="ElectricalDrawing" value="<?php echo $this->user->ElectricalDrawing; ?>" />Electrical Drawing<br/>
<input type="checkbox" class="form-control" name="boq" value="<?php echo $this->user->boq; ?>" />Bill of quantities (BOQ)<br/>
<input type="checkbox" class="form-control" name="construction" value="<?php echo $this->user->construction; ?>" />Construction of building<br/>
</div><!-- /.form-group -->
<br/>
<div class="form-group">
<input type="checkbox" class="form-control" name="terms" value="<?php echo $this->user->terms; ?>" required/>I agree to the Tcs and Cs
</div><!-- /.form-group -->
<div class="form-group">
<button type="submit" class="btn pull-right btn-default" id="form-contact-agent-submit">Apply Now</button>
</div><!-- /.form-group -->
<div id="form-contact-agent-status"></div>
<input type="hidden" name="agent_id" value="<?php echo $this->agent->id ?>">
<input type="hidden" name="task" value="agent.sendmsg" />
<input type="hidden" name="return" value="<?php echo base64_encode($this->uri->toString(array('path', 'query', 'fragment'))) ?>">
<?php echo JHtml::_('form.token'); ?>
</form><!-- /#form-contact -->
</div><!-- /.agent-form -->
</div><!-- /.col-md-5 -->
</section><!-- /.agent-form -->
</div><!-- /.row -->
</section><!-- /#contact-agent -->
付款按鈕>表格
<form role="form" id="pay" method="post" action="<https://www.voguepay.com/pay">
<!-- Payment button (hide after successful redirect, show only agent form?) -->
<div class="pay">
<input type='hidden' name='v_merchant_id' value='demo' />
<input type='hidden' name='merchant_ref' value='SC-CommitmentFee' />
<input type='hidden' name='memo' value='SC- Design Commitment Fee' />
<input type='hidden' name='developer_code' value='500000d1c' />
<input type='hidden' name='store_id' value='1' />
<input type='hidden' name='success_url' value='' />
<input type='hidden' name='fail_url' value='' />
<input type='hidden' name='total' value='1500' />
<input type='image' align="right" src='http://voguepay.com/images/buttons/make_payment_green.png' alt='Submit' />
</div>
</form>
成功URL應使用GET參數“ payment-success = 1”重定向回表單,然后可以進行封裝表單的條件:
$jinput = JFactory::getApplication()->input;
$paymentSuccess = $jinput->get('payment-success', '0', 'BOOL');
if ($paymentSuccess){
/* Display the form */
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.