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!
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
aukevdg
9,931 PointsAnyone 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....
<?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';
}