<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ping pong</title>
</head>
<body>
<center>
<form action = "proage.php" method = "POST">
<h3>Qué estilo de juego tienes</h3>
<img src="https://i.ytimg.com/vi/7GxYqIyyeW4/hqdefault.jpg">
<br>
<label>Ofensivo</label>
<br>
<input value="ofensivo" name = "EstiloDeJuego_1" type="radio">
<br>
<a style = "text-decoration: none;" href="index.php">1</a>
<a style = "text-decoration: none;" href = "index2.php">2</a>
<br>
<button name = "btn" type="submit">Enviar</button>
</form>
</center>
</body>
</html>
<?php
$sname= "localhost";
$unmae= "root";
$password = "";
$db_name = "pingpong";
$conexion = mysqli_connect($sname, $unmae, $password, $db_name) or die('No se ha conectado a la base datos correctamente');
if (isset($_POST['submit'])){
$ofensivo = $_POST['EstiloDeJuego_1'];
$sqlQuery = "INSERT INTO estilodejuego VALUES ($ofensivo)";
if(mysqli_query($conn,$sqlQuery)){
echo 'Dato guardado correctamente';
}
}
?>
Data is not inserting in the database. It's compiling, but not running. I just want to get to insert data in database. The database has 2 attributes: Id (Primary Key) Estilo
I'll be very grateful, if you answer me.
Thanks for all, you helped me since i had 15 years.