I have a form in PHP. When I submit it, I should get the values coming from $ _POST. But it turns out that the returned data comes only with value 1.
I do not know what's going on. Everything seems normal. :
<form method="POST" action="">
<input type="hidden" name="action" value="cadastrar_studante">
<div class="row mt20">
<div class="col-xs-6">
<div class="form-group">
<label class="control-label" for="name-student-form">Nome</label>
<input type="text" class="form-control" name="name-student-form" id="name-student-form">
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="control-label" for="email-student-form">Email</label>
<input type="email" class="form-control" name="email-student-form" id="email-student-form">
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<button type="submit" class="btn btn-primary pull-right">Cadastrar</button>
</div>
</div>
</form>
Here is PHP. I get the data for $ _POST. I'm using PHP PDO.
if( in_array("cadastrar_studante", $_POST) ) {
$name_student = isset( $_POST['name-student-form'] );
$email_student = isset( $_POST['email-student-form'] );
//echo $name_student . " <--> " . $email_student;
$students->set_name_student( $name_student );
$students->set_email_student( $email_student );
/** Inserir aluno */
if( $students->insert() ) {
$echo = <<<MSG
<script type="text/javascript">
jQuery(document).ready(function($)) {
$("#modal-feedback").find(".modal-body").html("Aluno cadastrado com sucesso.");
$("#modal-feedback").modal("show");
}
</script>
MSG;
echo $echo;
}
}