I'm working on a Google Compute Engine virtual instance to create a simple PHP application, I started testing the PHP environment and it seems the POST is not working properly because it is always empty
When I try var_dump
and print_r
, it returns null. I have also tried with $_REQUEST
and is also empty.
What could be wrong?
Here is the form I'm using
<form id="main-contact-form" class="contact-form" action="test.php" method="POST">
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<input type="text" class="form-control" required="required" placeholder="Nombre" name="name-contact">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<input type="text" class="form-control" required="required" placeholder="Email" name="email">
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="form-group">
<textarea name="message" id="message" required="required" class="form-control" rows="8" placeholder="Mensaje" name="message"></textarea>
</div>
<div class="form-group">
<button name="submit" type="submit" class="btn btn-danger btn-lg">Enviar Mensaje</button>
</div>
</div>
</div>
and in the test.php
I try something like
echo($_POST['name-contact']);
but the error log says that the 'name-contact' index is missing