I have read that there may be a security risk with something like this:
Calling file:
<p><a href="'.plugin_dir_url( __FILE__ ).'form-add-edit.php?funct=add_edit_form">Add a Date</a></p>
Called file/function has this at the top:
<?php
if ( $_GET['funct'] == 'add_edit_form' ) {
add_edit_form();
} else {
die;
}
function add_edit_form() {
etc.
?>
If a no-no, then what is the best practice? I considered jQuery/ajax but that doesn't seem any better.
UPDATE: The above was untested. This is what actually works, secure or not:
if ( isset($_GET['funct']) && $_GET['funct'] == 'add_edit_form' ) {
add_edit_form();
}
'form-add-edit.php?action=add_edit_formis symantically better?require_oncethe file containing the function and then call it where you want? Isn't it the point that you can embed PHP into HTML templates to generate the missing parts for the DOM?