Hello!
I would like to create a Wi-Fi hotspot for a Mikrotik router.
The user enters his name, email address and interests from a drop-down list in the login form.
The form sends the password and username required for entry hidden.
I would send the entered data to a database via ajax, and I would enter the hidden login data in the action.
The problem is that until you log in to the network, you will not reach the database where I would send the extra data.
After submitting the form, you just enter the network, there will be an Internet connection, but the values will not be entered into the database.
What is the solution for the data to be included in the database and for the username and password required for login to be sent?
<html>
<head>
<!-- <meta
http-equiv="refresh"
content="0; url=login?username=vendeg&password=123"
/>
<meta http-equiv="refresh" content="0; " /> -->
<meta charset="UTF-8" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="expires" content="-1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> -->
<script src="jquery.min.js"></script>
<title>Duna Autó internet - Log in</title>
<link rel="stylesheet" href="css/style.css" />
</head>
<body>
<div class="ie-fixMinHeight">
<div class="main">
<div class="wrap animated fadeIn">
<form method="POST" action="login">
<img class="logo" src="img/da_logo.png" alt="" />
<h1>BEJELENTKEZÉS</h1>
<table>
<tr>
<td style="border-bottom: none">
<input
type="hidden"
name="username"
placeholder="username"
id=""
value="vendeg"
/>
</td>
</tr>
<tr>
<td style="border-bottom: none">
<input
type="hidden"
name="password"
placeholder="jelszo"
id=""
value="123"
/>
</td>
</tr>
<tr>
<td>
<label for="name">Név:</label><br />
<input
type="text"
name="name"
placeholder="Kiss Gábor"
id="name"
required
/>
</td>
</tr>
<tr>
<td>
<label for="email">E-mail cím:</label><br />
<input
type="email"
name="email"
placeholder="pelda@gmail.com"
id="email"
required
/>
</td>
</tr>
<tr>
<td>
<label for="marka">Márka érdeklődés</label><br />
<select name="marka" id="marka" required>
<option value="abarth">Abarth</option>
<option value="citroen">Citroën</option>
<option value="cura">Cupra</option>
<option value="dacia">Dacia</option>
<option value="fiat">Fiat</option>
<option value="honda">Honda</option>
<option value="hyundai">Hyundai</option>
<option value="kia">Kia</option>
<option value="lada">Lada</option>
<option value="lancia">Lancia</option>
<option value="mitsubishi">Mitsubishi</option>
<option value="nissan">Nissan</option>
<option value="peugeot">Peugeot</option>
<option value="renault">Renault</option>
<option value="seat">Seat</option>
<option value="skoda">Skoda</option>
<option value="subaru">Subaru</option>
<option value="suzuki">Suzuki</option>
<option value="volvo">Volvo</option>
<option value="volkswagen">Volkswagen</option>
</select>
</td>
</tr>
<tr>
<td>
<input
type="submit"
name="submit"
value="KÜLDÉS"
id="submit"
/>
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
<script>
$(document).ready(function () {
$("#submit").click(function () {
var name = $("#name").val();
var email = $("#email").val();
var marka = $("#marka").val();
if (name == "" || email == "" || marka == "") {
alert("A összes mező kitötlése kötelező.");
return false;
}
$.ajax({
type: "POST",
url: "url/data.php",
data: {
name: name,
email: email,
marka: marka,
},
cache: false,
success: function (data) {
},
error: function (xhr, status, error) {
console.error(xhr);
},
});
});
});
</script>
</body>
</html>