Hello,
i'm troaing to set a valatation cod for my forum and i dont know how to get the valu from the inser text fild, can anibody help me pls
$ValidareNumar = $session->getData("device_id");
...
<div>
<label for="antispam_code">Anti spam code: <strong><?PHP echo $ValidareNumar; ?></strong></label>
<input type="text" name="antispam_code" id="antispam_code" value="" class="" placeholder="Introduceti codul aici" />
</div>
<?php
// my faild atempt
//$antispam_code = $sanitizer->int($input->post->antispam_code);
//$antispam_code=$session->getData("antispam_code")
//$antispam_code = Mage::app()->getRequest()->getPost('antispam_code');
if($session->get('antispam_code') == $ValidareNumar) {
Solved! Go to Solution.
<script src='https://www.google.com/recaptcha/api.js'></script>
<?php
if(isset($_POST[$ButonForm])){
$url = 'http://www.google.com/recaptcha/api/siteverify';
$privatekey="xxxxxxxxxxxxxx";
$response = file_get_contents($url."?secret=".$privatekey."&response=".$_POST['g-recaptcha-response']."&remoteip=".$_SERVER['REMOTE_ADDR']);
$data=json_decode($response);
if(isset($data->success) AND $data->success==true){
$action=$this->getFormAction();
?>
<h1>succes</h1>
<?php
}else{ ?>
<h1>faill la inregistrare</h1>
<?php
}
}else{ ?>
<h1>Buton neapasat</h1>
<?php
}
?>
<div id="messages_product_view"><?php echo $this->getMessagesBlock()->getGroupedHtml() ?></div>
<div class="page-title">
<h1><?php echo Mage::helper('contacts')->__('Contact Us') ?></h1>
</div>
<div class="map-content">
<div class="map"><?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('map_content')->toHtml() ?></div>
</div>
<div class="contact-left"><?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('contact_block')->toHtml() ?></div>
<form action="<?php echo $action ?>" id="contactForm" method="post">
<div class="fieldset">
<h2 class="legend"><?php echo Mage::helper('contacts')->__('Contact Information') ?></h2>
<ul class="form-list">
<li class="fields">
<div class="field">
<label for="name" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('Name') ?></label>
<div class="input-box">
<input name="name" id="name" title="<?php echo Mage::helper('contacts')->__('Name') ?>" value="<?php echo $this->htmlEscape($this->helper('contacts')->getUserName()) ?>" class="input-text required-entry" type="text" />
</div>
</div>
<div class="field">
<label for="email" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('Email') ?></label>
<div class="input-box">
<input name="email" id="email" title="<?php echo Mage::helper('contacts')->__('Email') ?>" value="<?php echo $this->htmlEscape($this->helper('contacts')->getUserEmail()) ?>" class="input-text required-entry validate-email" type="text" />
</div>
</div>
<div class="field last">
<label for="telephone"><?php echo Mage::helper('contacts')->__('Telephone') ?></label>
<div class="input-box">
<input name="telephone" id="telephone" title="<?php echo Mage::helper('contacts')->__('Telephone') ?>" value="" class="input-text" type="text" />
</div>
</div>
</li>
<li class="wide">
<label for="comment" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('Comment') ?></label>
<div class="input-box">
<textarea name="comment" id="comment" title="<?php echo Mage::helper('contacts')->__('Comment') ?>" class="required-entry input-text" cols="5" rows="3"></textarea>
</div>
</li>
</ul>
<?php
$ValidareNumar = $session->getData("device_id");
?>
<div class="captcha">
<div class="g-recaptcha" data-sitekey="xxxxxxxxxxxxxxxxxx"></div>
</div>
</div>
<div class="buttons-set">
<input type="text" name="hideit" id="hideit" value="" style="display:none !important;" />
<button type="submit" title="<?php echo $ButonForm; ?>" class="button"><span><span><?php echo Mage::helper('contacts')->__('Submit') ?></span></span></button>
<p class="required"><?php echo Mage::helper('contacts')->__('* Required Fields') ?></p>
</div>
</form>
<script type="text/javascript">
//<![CDATA[
var contactForm = new VarienForm('contactForm', true);
//]]>
</script>This is the curent version i end up
Stil dosent worck cant get the buton when is prest
and cant get the comand to submit the forum when the validation is ok
<script src='https://www.google.com/recaptcha/api.js'></script>
<?php
if(isset($_POST[$ButonForm])){
$url = 'http://www.google.com/recaptcha/api/siteverify';
$privatekey="xxxxxxxxxxxxxx";
$response = file_get_contents($url."?secret=".$privatekey."&response=".$_POST['g-recaptcha-response']."&remoteip=".$_SERVER['REMOTE_ADDR']);
$data=json_decode($response);
if(isset($data->success) AND $data->success==true){
$action=$this->getFormAction();
?>
<h1>succes</h1>
<?php
}else{ ?>
<h1>faill la inregistrare</h1>
<?php
}
}else{ ?>
<h1>Buton neapasat</h1>
<?php
}
?>
<div id="messages_product_view"><?php echo $this->getMessagesBlock()->getGroupedHtml() ?></div>
<div class="page-title">
<h1><?php echo Mage::helper('contacts')->__('Contact Us') ?></h1>
</div>
<div class="map-content">
<div class="map"><?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('map_content')->toHtml() ?></div>
</div>
<div class="contact-left"><?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('contact_block')->toHtml() ?></div>
<form action="<?php echo $action ?>" id="contactForm" method="post">
<div class="fieldset">
<h2 class="legend"><?php echo Mage::helper('contacts')->__('Contact Information') ?></h2>
<ul class="form-list">
<li class="fields">
<div class="field">
<label for="name" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('Name') ?></label>
<div class="input-box">
<input name="name" id="name" title="<?php echo Mage::helper('contacts')->__('Name') ?>" value="<?php echo $this->htmlEscape($this->helper('contacts')->getUserName()) ?>" class="input-text required-entry" type="text" />
</div>
</div>
<div class="field">
<label for="email" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('Email') ?></label>
<div class="input-box">
<input name="email" id="email" title="<?php echo Mage::helper('contacts')->__('Email') ?>" value="<?php echo $this->htmlEscape($this->helper('contacts')->getUserEmail()) ?>" class="input-text required-entry validate-email" type="text" />
</div>
</div>
<div class="field last">
<label for="telephone"><?php echo Mage::helper('contacts')->__('Telephone') ?></label>
<div class="input-box">
<input name="telephone" id="telephone" title="<?php echo Mage::helper('contacts')->__('Telephone') ?>" value="" class="input-text" type="text" />
</div>
</div>
</li>
<li class="wide">
<label for="comment" class="required"><em>*</em><?php echo Mage::helper('contacts')->__('Comment') ?></label>
<div class="input-box">
<textarea name="comment" id="comment" title="<?php echo Mage::helper('contacts')->__('Comment') ?>" class="required-entry input-text" cols="5" rows="3"></textarea>
</div>
</li>
</ul>
<?php
$ValidareNumar = $session->getData("device_id");
?>
<div class="captcha">
<div class="g-recaptcha" data-sitekey="xxxxxxxxxxxxxxxxxx"></div>
</div>
</div>
<div class="buttons-set">
<input type="text" name="hideit" id="hideit" value="" style="display:none !important;" />
<button type="submit" title="<?php echo $ButonForm; ?>" class="button"><span><span><?php echo Mage::helper('contacts')->__('Submit') ?></span></span></button>
<p class="required"><?php echo Mage::helper('contacts')->__('* Required Fields') ?></p>
</div>
</form>
<script type="text/javascript">
//<![CDATA[
var contactForm = new VarienForm('contactForm', true);
//]]>
</script>This is the curent version i end up
Stil dosent worck cant get the buton when is prest
and cant get the comand to submit the forum when the validation is ok