How to access form data in hook_form_validate() in drupal 7

1 reply [Last post]
vishalkhialani
Offline
Last seen: 3 years 44 weeks ago
Joined: 2011-11-08

I have a form implemented from hook_form called simplequiz_form() I want to access its data after its submitted.

Below is the code I have written but I can't seem to access its data once its submitted. What am I doing wrong ?

function simplequiz_form_validate($form, &$form_state) {
// here is where we will validate the data and save it in the db.
$thid = db_insert('simplequiz')
->fields(array(

'questions' => &$form_state['question'],
I can't seem to access the value of a field questions

))
->execute();

return $thid;
}

vishalkhialani
Offline
Last seen: 3 years 44 weeks ago
Joined: 2011-11-08
I managed to solve it . I

I managed to solve it . I need to use 'questions' => $form_state['values']['question']['value'],

Add to playlist

Add to , or

Add to new playlist:

Add to playlist
This is a member-only feature
But, it's easy to become a member

Add to cart:


Loading...
Contact us

Below are the supported keyboard shortcuts for our video player.

space
Start / stop video
shift
Go to next video
shift
Go to previous video
Increase or decrease player speed by 20%
Skip ahead or go back by 15 seconds
1...9
Jump to a percentage (2 is 20%, for example)
f
Toggle full screen
Videos Pricing More Search
BuildAModule Logo Icon BuildAModule Logo Icon
Become a member!
$29
1 month
$156
6 months
10% off
$276
12 months
20% off
All memberships come with the following:
24 / 7 access to the entire 1800+ video library
An innovative video player with a rolling transcript
Extensive Drupal and cross-platform training
A thorough and thoughtful training style
Progress tracking
Take notes on specific video sections
Intuitive multi-user management
How many users?
user
Go solo with a single user, or give multiple team members access through one account and get discounts by bundling multiple users into a single membership.