WordPress.org

Ready to get started?Download WordPress

Plugin Directory

300form

Like the Spartans at Thermopylae, these 300 lines of code are meant to protect your forms from malicious invaders.

How to install

  1. Upload 300form.php to the /wp-content/plugins/ directory
  2. Activate the plugin through the 'Plugins' menu in WordPress
  3. Get a 'form' class instance. See the files 'page-300form.php' and 'template.php' for example usage.

Optional:

  1. Copy the 'page-300form.php' to your theme folder
  2. Create a page in the editor using '300form-example' as a template
  3. Access the example form in the frontend

How to use (example):

$form = new form();
$form->required = array( 'form_lastname' );
$form->pattern = array( 'form_lastname' => '!^[a-zA-Z]+$!' );
$form->process( $_POST );
$data = $form->processed_data;

your_form_template

<input type="text" name="form_lastname" placeholder="Your Name" value="<?php $form->data( 'form_lastname' ); ?>" />
<span style="color:red"><?php $form->hint( 'form_lastname' ); ?></span>


/your_form_template

API

  • $required | array containing names of required form fields
  • $pattern | array containing key/value pairs of field names and their corresponding regular expressions
  • $process( $data ) | function that starts the validation process. Must be passed REQUEST data as first parameter
  • $processed_data | If all validation checks are passed, this var contains the validated REQUEST data
  • $data( $handler ) | wrapper for get_data( $handler ). Outputs the value entered in the $handler form field
  • $hint( $handler ) | wrapper for get_hint( $handler ). Outputs the form field's hint

Requires: 3.3.2 or higher
Compatible up to: 3.4.2
Last Updated: 2012-6-27
Downloads: 266

Ratings

0 stars
0 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1