I am currently programming a plugin for wordpress which needs to execute a PHP command in the action tag of a form. This is my current code which gets echoed (of course with closing tags in the end):
<form action="'<?php echo admin_url('admin-ajax.php'); ?>'" method="post" >
<?php wp_nonce_field('csv_submit','csv_nonce'); ?>
<input type="hidden" name="action" value="csv_submit">
When I execute it like this the browser tries to open localhost/'<?php echo admin_url('admin-ajax.php'); which, of course, doesn't exist. How can I fix it so the browser won't see it as reference, but like PHP code?
Edit 1:
The code is placed in the shortcode-function of my plugin. It is the beginning of a String that is returned at the end of the function.
function csvcontact(){
$output = file_get_contents('csvcontact/formstart.php', true); //Here lies the shown code
// Here happens something with the given attributes
$output .= '</form>';
return $output;
}