Short source code examples

A PHP function that strips a string of all characters other than alphanumeric characters:

function onlyAlphanumericAndSpaces($text) {
  # allow only alphanumeric
  return ereg_replace("[^A-Za-z0-9 ]", "", $text );
}
/**
 * Implementation of hook_form_alter().
 * Use these functions to alter the "charity" forms.
 */
function user_validator_form_charity_node_form_alter(&$form, &$form_state) {

  $form['bookverify'] = array(
      '#type' => 'fieldset',
      '#title' => t('Confirmation'),
      '#weight' => 20
    );
  $form['bookverify']['words'] = array(
      '#type' => 'textfield',
      '#title' => t('First five words from Lesson 12'),
      '#descripti