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 ....

  2. Josh Lockhart closed this discussion on 12 Feb, 2021 07:42 PM.

Comments are currently closed for this discussion. You can start a new one.

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