-1
  <form action="newsletter" method="POST">
                        <div class="input-group">
                          <input type="email" class="form-control box-style-1" size="50" name="email" placeholder="Your email" required>
                          <input type="hidden" name="code" value="<?php echo $code; ?>" >
                          <div class="input-group-btn">

                            <button type="submit" class="btn subscribe-btn">Subscribe</button>
                          </div>
                        </div>
                     </form>

I have tried to send a hidden code (randomly generated) through form but i am not able to prevent the spam.

Abhishek Singh
  • 81
  • 1
  • 2
  • 11

1 Answers1

-1

Random code has to be a part of JavaScript, otherwise it'll be simply parsed by bots

Use reCapcha for that; or extra-header for each request (that will be a part of JS); or check RELATIVE_URL to validate that submit was done from your site.

FieryCat
  • 1,875
  • 18
  • 28