0

How can I get string values from URL and save them as array, right now URL looks like this somename[]=xxxxxxxxx&somename[]=zzzzzzzzz&somename[]=zsdasd

$jinput = JFactory::getApplication()->input;
$nameArray = $jinput->get('somename');

If I var_dump $nameArray I get this Array and I var_dump $jinput I get this:

[data:protected] => Array
    (
        [somename] => Array
            (
            [0] => xxxxxxxxx
            [1] => zzzzzzzzz
            [2] => zsdasd
        )

    [option] => com_content
    [view] => featured
    [Itemid] => 101
)

I want to echo $nameArray like $nameArray[0] and get results "xxxxxxxxxx" but now i get Array instead.

0

1 Answer 1

1

Try something like this,

$somename = JRequest::getVar('somename',array(),'', 'ARRAY');

echo "<pre/>";
print_r($somename);

Hope its helps..

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.