Reputation: 697
I am developing a WordPress plugin which has a form.I am having trouble getting the php file to recognize that a form has been submitted. The idea is once i hit the submit button, then the page will reload and alert "Form Submitted"
PHP
add_shortcode('show_game_form','ate_form_activate');
function ate_form_activate(){
if(is_page('Commercial'))
{
if(isset( $_POST['ate-final-submi'] ))
{
//NOT ALERTING!!!!!!
echo "<script type='text/javascript'> alert('Submitted Form'); </script>";
}
//Display Page
$myfile = fopen("/ATE-Form/index.html", "r") or die("Unable to open file!");
echo fread($myfile,filesize("/ATE-Form/index.html"));
fclose($myfile);
return "";
}
}
HTML
<form id="ate-final-submi" name="ate-final-submi" method="post" action=""><br>
<input type="text" id="ate-final-email" name="ate-final-email" value="asfd">
<button type="button" id="ATE-backButton" class="ATE-nav-button">« Back</button>
<button type="submit" name="ATE-submitButton" id="ATE-submitButton" class="ATE-nav-button">
</form>
Upvotes: 0
Views: 530
Reputation: 3610
You may try adding this to your HTML:
<?php if (!empty($_POST['ATE-submitButton'])): ?>
<script>
alert('Form Submitted');
</script>
<?php endif ?>
Upvotes: 1