I was trying to run a php app on heroku, and i started playing with their example. however, I am having some trouble because their example (here: https://devcenter.heroku.com/articles/getting-started-with-php ) uses silex/symfony, which I know nothing about (i'm pretty noob with php and html as well actually..). So sorry for the very noob question..
My problem is the following: how can i store as global the value of a input type text from index.twig and use it in the index.php file?
I am probably totally wrong, but I couldn't find any clear basic tutorial for that online, so if you can provide a detailed step by step answer would be much appreciated.
This is my views/index.twig:
{% extends "layout.html" %}
{% block content %}
<br>
Levee:<br>
<input type="text" name="test" />
<br>
{% endblock %}
Here is my layout.html
<!DOCTYPE html>
<html>
<head>
{% include 'header.html' %}
</head>
<body>
{% include 'nav.html' %}
{% block content %}{% endblock %}
</body>
</html>
And here is my index.php
<?php
require('../vendor/autoload.php');
$app = new Silex\Application();
$app['debug'] = true;
// Register the monolog logging service
$app->register(new Silex\Provider\MonologServiceProvider(), array(
'monolog.logfile' => 'php://stderr',
));
// Register view rendering
$app->register(new Silex\Provider\TwigServiceProvider(), array(
'twig.path' => __DIR__.'/views',
));
// Our web handlers
$app->get('/', function() use($app) {
$app['monolog']->addDebug('logging output.');
return $app['twig']->render('index.twig');
});
$dbopts = parse_url(getenv('DATABASE_URL'));
$app['var1'] = ?????????
$app->run();
So the question is: how can I store the value of into $app['var1'] ?
Thanks in advance