Good, I would like to obtain data in the same php page, in a login, the problem is that when I enter the values in my login, I save them by POST, but it seems that it always saves me NULL.
.boxlogin{
border-radius:4px;
box-shadow: 2px 2px #d6d6d6;
margin: 75px auto;
width: 320px;
-webki-border-radius:4px;
-moz-border-radius:4px;
}
.btn{
margin-top: 14px;
}
<html lang="en">
<head>
<meta charser="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" href="css/estilos.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="js/jquery.js"></script>
<script src="~/js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<header>
</header>
<div class="jumbotron boxlogin">
<form method="post" name="flogin" id="flogin" action="" >
<label>Usuario:</label>
<input type="text" name="username" class="form-control">
<label>Contraseña:</label>
<input type="password" name="password" class="form-control">
<button name="btnClickI" type="button" class="btn btn-success" data-toggle="modal" data-target="#ingreso">Ingresar</button>
<a href="registro.php"><button value="btnClickR" type="button" class="btn btn-info">Registrar</button></a>
<?php
if(!isset($_POST['btnClickI'])){
$username=isset($_POST['username'])?var_dump($_POST['username']):NULL;
$password=isset($_POST['password'])?var_dump($_POST['password']):NULL;
if( $username==NULL or $password==NULL ) {
echo '<div id="ingreso" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-diolag">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<h3>Por favor llenar todo los campos!</h3>
</div>
</div>
</div>
</div>';
}else{
echo '<div id="ingreso" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-diolag">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<h3>Enviando datos!...</h3>
</div>
</div>
</div>
</div>';
}
}
?>
</form>
</div>
<script type="http://code.jquery.com/jquery-latest.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>