Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Hidden form field to stop spam

Featured Replies

Hi all. I've been using a simple php script for my contact forms but keep getting a lot of junk mail. I've heard that you can use a hidden form field and get the PHP script to abort sending if the field is filled in by an automated spam bot. Please could someone help me implement this? I've looked at a few tutorials but they are too complicated for me as I'm not too good with PHP :/ Heres my form and script. Thanks a lot :)

<form name="test" action="process.php" method="post">
<input name="validate" type="hidden" />
<input name="name" type="text" />
<input name="email" type="text" />
<textarea name="message" cols="" rows=""></textarea>
<input name="submit" type="submit" value="Submit">
</form>

---------------------
<process.php>

$emailSubject = 'Message From Website';
$webMaster = 'xxx@xxx.com';

$name = $_POST['name'];
$email = $_POST['email'];
$message = $_POST['message'];
$body = <<<EOD

Customer Name: $name <br><br>
Email Address: $email <br><br>
Message: $message
EOD;

$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$string=nl2br($string);
$success = mail($webMaster, $emailSubject, $body, $headers);

  • Author

Thanks Lyndsey, that's just what I was looking for - something simple :) I may look into more advanced options if I still get spammed. Thanks guys

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.