Requesting help in posting form data

Hi All,

Request you help in posting form data, in the same page. I am suing Silm version 2.6

index.php

<?php require_once('../includes/Twig/Autoloader.php'); require_once('../includes/Slim/Slim.php'); \Slim\Slim::registerAutoloader(); $app = new \Slim\Slim(array( 'templates.path' => '../tpl' )); $app->view(new \Slim\Views\Twig()); $app->view->parserExtensions = array(new \Slim\Views\TwigExtension()); $app->get('/Search', function() use ($app) { $al = new ansibleLogger(); $app->render('search.html'); }); $app->post('/', function() use ($app) { $request = $app->request(); $autoname = $request->post('auto'); echo("$autoname"); }); $app->run(); ?>

search.html
{% extends “index.html” %}
{% block content%}

Playbook: Search Cars Bike Vehicle No:
<?php if(isset($_POST['SubmitButton'])){ $AUTO = $_POST["auto"]; echo $AUTO; } ?>

More interesting would be to see your actual form source code in twig, for example:
<form autocomplete=“off” method=“post” action="{{ path_for(‘search’, {‘lang’ : lang}) }}" name=“appsearch” id=“appsearch”>

I don’t know what other people do, but my action points to a named route, which additionally in my case includes a language param.

Hi,

I posted a normal html-form.
This actually filled $_FILES and therefore also getUploadedFiles().
The header from the succesful html-form : “Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryYGlIpt9b7IesaLgK”
While the angular has only “Content-Type: multipart/form-data”, but has a request-payload with : “------WebKitFormBoundarylqfoeflquuI28Il0
Content-Disposition: form-data; name=“logostream”; filename=“sunsmaller (kopie).png”
Content-Type: image/png
------WebKitFormBoundarylqfoeflquuI28Il0–”

Why the angular approach does not or why the method differs I do not know yet. This I have to find out. The angular approach did work in Slim3.

Hi,

A already know the problem. I accidentally added " Content-Type:application/json; charset=utf-8", thus the stream was in the payload instead of the header. It was a client-side problem. Thanks for the help anyway!

bye!