The Slim Framework support forum has moved to http://discourse.slimframework.com. This Tender forum is no longer maintained or monitored.

pass array to post data

haard's Avatar

haard

17 Aug, 2015 12:29 PM

I want to pass array of email addresses using post request but it can't work.

$app->post('/register', function() use ($app) {
            // check for required params
            verifyRequiredParams(array('emailto', 'emailfrom', 'message', 'password', 'totalsize', 'totalfiles'));

            $response = array();


            // reading post params
            $emailto = $app->request->post('emailto');
            $emailfrom = $app->request->post('emailfrom');
$message = $app->request->post('message');
        
            // validating email address
            validateEmail($emailfrom);
           
            $db = new DbHandler();
            $res = $db->createUser($emailto, $emailfrom, $message);
            // echo json response
            echoRespnse(201, $response);
        });

i am receiving these way parameters.

  1. 1 Posted by hard.thkr on 17 Aug, 2015 01:10 PM

    hard.thkr's Avatar

    If i pass using the same name multiple parameters then it returns only last value ....

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac