Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Building Websites with PHP Contact Form & Sending Email POST Route & Data

var_dump() is posting the form data in the URL

When I fill the form and click submit, the data is posted in the URL.... (I'm using Xaamp)

screenshot: http://imgur.com/a/pQfwz

Please Help!

My code:



<h2>Ralph Waldo Emerson</h2>

<p>Unfortately, Ralph Waldo Emerson has been deceased for over 100 years so he's not particularly expediant at replying to email but you can make an attempt below. However, if you require face to gravestone contact you can visit his remains at:</p>
  <h4>Sleepy Hollow Cemetery</h4>
  <p>34 Bedford Street<br>
  Concord, MA 01742, United States<br>
<a href="https://www.google.com/maps/place/Sleepy+Hollow+Cemetery/@42.464126,-71.343098,15z/data=!4m2!3m1!1s0x0:0x9c41d0f83df689a6?sa=X&ei=ZCgLVZb5Io_hoASc7oHwCQ&ved=0CH0Q_BIwCw">Google Map</a></p>

<form action="" method="post">
    <input name="name" type="text" placeholder="Full Name">
    <input name="email" type="email" placeholder="Email Address">
    <textarea name="msg" placeholder="Your message..."></textarea>
  <input type="submit" class="button">

{% endblock content %}


index.php: '''


require 'vendor/autoload.php';

$app = new \Slim\Slim(array(
    'view' => new \Slim\Views\Twig()

$view = $app->view();
$view->parserOptions = array(
    'debug' => true,

$view->parserExtensions = array(
    new \Slim\Views\TwigExtension(),

/***** ROUTING *****/
$app->get('/', function() use($app) {
    $app -> render('about.twig');

$app->get('/contact', function() use($app){
    $app -> render('contact.twig'); 

$app->post('/contact', function() use($app){




That is the default behavior of the browser. You haven't connected the form action to your routes. That's why the info is appearing in the URL.

<form action="/contact" method="post">

Will send the post data to the contact route.