Forums

captcha plugin code not replaced when form code PHP include

jj135 11 Jun, 2010
Hi,

I usually include my form code form a file on my server. This way it is easier for me to make changes. This is how it's done:

1. I upload the form code to the server (for example: formulieren/contact_formulier.php)
2. In Chronoforms I open the 'Form Code' tab insert this: (Form HTML)
<?php include('formulieren/contact_formulier.php');?>


Now I can edit the for code localy on my computer (dreamweaver), upload it and the online form has changed.

I do the same for the email templates.

Now this is my problem:

When I use this PHP include in the From Code, the tag {imageverification} is not replaced with the verification image. All the other elements of the form are shown correctly.

When I replace the PHO include with the EXACT same code as the included file, the captcha image is showing fine.

Can anayone explain why this happens and how to fix this?
I could of course just edit the code in the Form Code tab, but I really like my PHP include way of doing things.
nml375 11 Jun, 2010
Hi jj135,
Unfortunately, the substitution of {imageverification} is done just before the Form HTML code is passed to the eval() function. Thus, by the time your php-files are included, the substitution has already been done.

You could, however, try this instead of {imageverification}:
<?php
if (!empty($imver)) {
  echo $imver;
}
?>


/Fredrik
GreyHead 11 Jun, 2010
Hi jj135,

You could also replicate the ChronoForms code to generate the code
if ( trim($MyForm->formparams('imagever')) == 'Yes' ) {
  $imver = '<input name="chrono_verification" style="vertical-align:top;" type="text" id="chrono_verification" value="" />  <img src="'.$CF_PATH.'components/com_chronocontact/chrono_verification.php?imtype='.$MyForm->formparams('imtype').'" alt="" />';
}
Will need some modification to get rid of the $MyForm references.

Bob
This topic is locked and no more replies can be posted.