getElementValues()

clonefish->getElementValues() - get the values of all the form elements in an array.

Description

class clonefish {
  array getElementValues( boolean $addslashes )
}

This method returns an array of element values in an associative array.

Clonefish is transparent by concept: if you rely on the magic quoting feature of PHP, you can use the following method to replace processing $_POST/$_GET/$_COOKIE/$_REQUEST arrays:

<?php

$form 
= new clonefish( [...] );
$form->addElements$_POSTget_magic_quotes_gpc() );
print_r$form->getElementValuesget_magic_quotes_gpc() );

?>

The code above will return the very same as a print_r( $_POST ); - quoted values if magic_quotes_gpc is set, and unquoted if unset.

Through the very same required parameter in addElements(), getElementValues(), setValue() and getVale() clonefish enforces building safe applications and websites.

Parameters

$addslashes

The only parameter this method requires is the $addslashes parameter. When set to TRUE, slashes will be added using the built-in addslashes() PHP function for all the values returned. When $addslashes is FALSE, no quotes are added.

Examples

<?php

$values 
$clonefish->getElementValues);
print_r$values );

?>


The output:

Array(
  'name'     => 'James Bond',
  'id'       => '007',
  'language' => 'en'
)

form validation for developers!

clonefish is a proven, mature form generator class that helps PHP developers to create, validate and process secure, flexible and easy-to-maintain forms
learn more
Bookmark and Share