-4

I got error

Undefined variable: site_key in public_html/catalog/view/theme/optimus/template/information/contact.tpl on line 136

This is code of line no 136

Line no 136

<?php if ($site_key) { ?>  line                 
                      <div class="form-group">
                          <div class="col-sm-offset-2 col-sm-10">
                              <div class="g-recaptcha" data-sitekey="<?php echo $site_key; ?>"></div>
                              <?php if ($error_captcha) { ?>
                              <div class="text-danger"><?php echo $error_captcha; ?></div>
                              <?php } ?>
                          </div>
                      </div>
                      <?php } ?>

Not able to found captcha. I am using opencart 2.0.1.1

Please help me to resolve this thanks

1 Answers1

0

the variable $site_key is not defined, and you are attempting to test if it returns a true value in your If statement ( which it doesen't, since it is not even defined )

To check wether or not a variabel is defined, use the isset function call, then you can check if it's value is true.

if( isset( $site_key )  and $site_key )
{
  line                 
                      <div class="form-group">
                          <div class="col-sm-offset-2 col-sm-10">
                              <div class="g-recaptcha" data-sitekey="<?php echo $site_key; ?>"></div>
                              <?php if ($error_captcha) { ?>
                              <div class="text-danger"><?php echo $error_captcha; ?></div>
                              <?php } ?>
                          </div>
                      </div>
}
Julio Soares
  • 1,200
  • 8
  • 11
Jonas m
  • 2,646
  • 3
  • 22
  • 43