Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Drupal Basics Writing Modules Drupal Modules Review

aukevdg
aukevdg
9,931 Points

Anyone know how to get this array into the next function?

I've tried a lot of different things I found on the big Google, but I can't get to grab the right parameter from that array....

my_profile.module
<?php

function my_profile_form() {
    $form = array();
    $form['age'] = array(
        '#title' => 'Age',
        '#type' => 'textfield',
        '#description' => t('Please enter your age.'),
    );    
    $form['submit'] = array(
        '#type' => 'submit',
        '#value' => 'Go',
    );
    return $form;
}

function my_profile_form_submit($form, &$form_state) {

    $user_age = $form_state[β€˜input’][β€˜Go’];

    $_SESSION['age'] = $user_age;  
    $form_state['redirect'] = 'created';
}