Reputation: 13434
Hello so I currently have a working form for submission in slim framework. This is how my html looks like:
<form method="POST" action="/user/register-link">
<input type="text" name="txt_fname"> <br />
<input type="text" name="txt_lname"> <br />
<input type="submit">
</form>
And in my routes:
$request = \Slim\Slim::getInstance()->request();
parse_str($request->getBody(), $output);
echo $output['txt_fname'];
echo $output['txt_lname'];
All the code above is actually working. Now if I want to add enctype='multipart/form-data'
in my form and another <input type="file" name="filename">
inside the form, when I try to submit I get an error of Undefined index: txt_fname
. What is the possible mistake in my code?
Upvotes: 0
Views: 388
Reputation: 3408
You could try to use Slim-built-in functionality to get all Post params: $request->post();
If your file will not shown there you may need to use $_FILES
to handle that file upload.
Upvotes: 1