Skip to content

Commit

Permalink
Added extra validation with isset()
Browse files Browse the repository at this point in the history
Prevents error on page refresh after form submission
  • Loading branch information
Stevie Cotterill committed Jan 30, 2019
1 parent d6eb4a6 commit 127636e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<div class="column is-half">

<?php // Check if form was submitted:
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['recaptcha_response'])) {

// Build POST request:
$recaptcha_url = 'https://www.google.com/recaptcha/api/siteverify';
Expand All @@ -41,7 +41,6 @@
} else {
// Not verified - show form error
}

} ?>

<form method="POST">
Expand Down

0 comments on commit 127636e

Please sign in to comment.