Hi
Am a Noob with Drupal and finding the Forms API very frustrating. Could anyone help me?
I've had the same problems as the people in this post: http://drupal.org/node/119117, but none of the solutions there work, i still just get a blank output. What am I doing wrong?
This is really annoying me because it will be the core part of my site & it took about an hour to code in standard PHP/MySQL - but two days later I still can't get this blasted Drupal Forms API to work - and it's meant to make things easier!
Here's my code, which is completely derived from the Form API QuickStart:
<?php
function teachers() {
$form = array();
$form['title'] = array(
'#type' => 'textfield',
'#title' => t('title'),
);
$form['forename'] = array(
'#type' => 'textfield',
'#title' => t('forename'),
);
$form['surname'] = array(
'#type' => 'textfield',
'#title' => t('surname'),
);
$form['email'] = array(
'#type' => 'textfield',
'#title' => t('email'),
);
$form['submit'] = array (
'#type' => 'submit',
'#value' => t('Go'),
);
return $form;
}
function teachers_validate($form_id, $form_values) {
if ($form_values['surname'] == '') {
form_set_error('', t('You have to put in a surname'));
}
if ($form_values['forename'] == '') {