Hello everyone, I'm new around here. I've been trying to implement a feature on my site.
I have a form that gets called on every page in my site. It accepts just one value, a text input. This text input is suposed to form a query string for an external URL that gets called up in an iframe on a unique page on my site. I've tried setting the variable value as a session using <cms:set_session > to no avail. I hope somebody will be able to guide me on how to go about it.
I have a fair grasp of PHP generally by the way. Thanks
This is the code for the form:
This is the code for the iframe. The iframe is invoked using shortcode.
I have a form that gets called on every page in my site. It accepts just one value, a text input. This text input is suposed to form a query string for an external URL that gets called up in an iframe on a unique page on my site. I've tried setting the variable value as a session using <cms:set_session > to no avail. I hope somebody will be able to guide me on how to go about it.
I have a fair grasp of PHP generally by the way. Thanks
This is the code for the form:
- Code: Select all
<section class="message-wrap2">
<cms: form class="quform" method="post" enctype="multipart/form-data" onclick="">
<cms: if k_success >
<cms: set_session name ='vrm' value ="frm_name" / >
<cms: redirect '/lookup' / >
</cms: if>
<div class="row" style="background:#e22d2d;color:white">
<div class="col-sm-12">
<h4 style="color:white;margin-top:20px;text-align:center">Find out how a remap will benefit your vehicle</h4>
<div class="centerform"><div class="quform-elements">
</div></div></div>
</div>
<div class="row" style="background:#e22d2d;color:white">
<div class="col-sm-4" style=";margin-top:-10px">
<p style="color:white;font-size:11pt;text-align:center">Complete the form <br>or<br>call 07594 500487</p>
</div>
<div class="col-sm-4">
<div class="quform-input"> <div class="input-group" style="width:100%;background:blue;border-radius:0px;border:3px solid blue">
<span class="input-group-addon" id="basic-addon1" style="background:blue;color:yellow;font-size:10pt;border-radius:0px"><b>GB</b></span>
<input type="text" class="form-control" placeholder="Vehicle Registration (Required)" name="name" style="background:#f9e563;border-radius:0px;height:30px;margin-right:5px">
</div>
</div></div>
<div class="col-sm-4" >
<!-- Begin Submit button -->
<button type="submit"><span><em>Send</em></span></button>
<div class="quform-loading-wrap"><span class="quform-loading"></span></div>
</div>
<br> <br>
<span id="error_message" style="color:white"></span>
</div>
</cms:form>
<!--message-wrap ends-->
This is the code for the iframe. The iframe is invoked using shortcode.
- Code: Select all
<?php
if ( !defined('K_COUCH_DIR') ) die(); // cannot be loaded directly
//require_once( K_COUCH_DIR.'addons/cart/session.php' );
//require_once( K_COUCH_DIR.'addons/cart/cart.php' ); // automatically includes session
//require_once( K_COUCH_DIR.'addons/data-bound-form/data-bound-form.php' );
//require_once( K_COUCH_DIR.'addons/inline/inline.php' );
//require_once( K_COUCH_DIR.'addons/extended/extended-folders.php' );
//require_once( K_COUCH_DIR.'addons/extended/extended-comments.php' );
//require_once( K_COUCH_DIR.'addons/extended/extended-users.php' );
//require_once( K_COUCH_DIR.'addons/routes/routes.php' );
// 2.
// IFrame shortcode
// Usage: [iframe src="http://www.somesite.com/" width="100%" height="625" scrolling="yes" frameborder="1" marginheight="2"]
$FUNCS->register_shortcode( 'iframe', 'iframe_handler' );
function iframe_handler( $params, $content=null ){
global $FUNCS;
extract( $FUNCS->get_named_vars(array(
'src' => 'https://www.direg.co.uk/dealer-tool/responsive-vehicle-look-up-tool/lookup.aspx?vrm= <cms:get_session 'vrm' />&ref=Anglian%20Remaps%20-%20Dealer%20Tool',
'width' => '100%',
'height' => '1500',
'id' => 'anglianremapstool',
'scrolling' => 'no',
'frameborder' => '0',
'marginheight' => '0'
), $params) );
$html =<<<EOS
<iframe id="$id" src="$src" title="" width="$width" style="height: 1125px;" scrolling="$scrolling" frameborder="$frameborder" marginheight="$marginheight">
<a href="$src" target="_blank">$src</a>
</iframe>
EOS;
return $html;
}