Welcome Guest, Not a member yet? Register   Sign In
Friday afternoon problem array question
#1

[eluser]tim1965[/eluser]
Sorry in advance i know this is easy. But my brain doesnt seem to functioning today.
I want to add
$propid = $this->session->userdata('propid');
to a POST array
If i var_dump $propid i get
Quote:
array(1) { ["prop_id"]=> array(1) { [0]=> string(1) "5" } }
Quote:
So if i use
$form['property_id'] = $propid['prop_id'];
It adds "array" rather than "5", which is the value i am trying to get

Any help appreciated
#2

[eluser]majidmx[/eluser]
As you can see in your var_dump
Code:
$propid['prop_id']
is an array by itself so there is no doubt that you'll get "array" when you want to print $form['property_id'] after
[/code]
Code:
$form['property_id'] = $propid['prop_id'];

instead try to print this :

Code:
echo    $form['property_id'][0];

or you can simply use this :
Code:
$form['property_id'] = $propid['prop_id'][0];
and print out :
Code:
echo    $form['property_id'];
#3

[eluser]tim1965[/eluser]
Thank you, fixed it, have a great weekend !




Theme © iAndrew 2016 - Forum software by © MyBB