You can add PHP code to a page where a Contact Enhanced form is published.
1. Select Components → Contact Enhanced → Form Fields from the drop-down menu on the back-end of your Joomla! installation, then Select PHP from the Field Type select list;
2. Choose a category for your Form Field, then Save the changes. Joomla 1.6+ comes with a WYSIWYG code editor called CodeMirror. If CodeMirror is enabled Contact Enhanced will load it after the page is saved.
3. Add the your PHP code to the value field and save;
DO NOT add the php tags <?php, <? and ?>
This feature uses PHP EVAL function, so in case of a fatal error in the evaluated code, the whole script exits.'
PHP Eval Function can be Dangerous if not used carefully.
In order to increase security, only a few variables are allowed to use;
The PHP Form Field has no specific parameters, but you can change the General Parameters. If you choose to add a hidden field, you will probably want to hide the label, if that's the case, go to General Parameters and set "Hide field Label" to Yes.
The image on the right is one simple example of how PHP can be used.
With Contact Enhanced you can add many other form fields types, but for the purposes of this example there are only 3 (Name, Email, PHP );
// This will add a text field populated with the site title $temp=$doc->getTitle();
$html='<input type="text" id="'.$cf->alias.'"
class="inputbox '.($cf->required ? 'required' : '').'"/>';
Recommend to a friend
Copyright © 2018 IdealExtensions.com. All Rights Reserved.