Requesting help in posting form data

#1

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; } ?>
#2

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.