-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinsert.php
30 lines (23 loc) · 1.01 KB
/
insert.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
require('dbconfig/config.php');
$name = $_REQUEST['name'];
$age = $_REQUEST['age'];
$position = $_REQUEST['position'];
$nationality = $_REQUEST['nationality'];
$club = $_REQUEST['club'];
$goals_scored = $_REQUEST['goals_scored'];
$assist = $_REQUEST['assist'];
$red_cards = $_REQUEST['red_cards'];
$yellow_cards = $_REQUEST['yellow_cards'];
$clean_sheets = $_REQUEST['clean_sheets'];
$goals_conceded = $_REQUEST['goals_conceded'];
$sql = "INSERT INTO players (name, age, position, nationality, club, goals_scored, assist, red_cards, yellow_cards, clean_sheets, goals_conceded)
VALUES ('$name', '$age', '$position', '$nationality', '$club', '$goals_scored', '$assist', '$red_cards', '$yellow_cards', '$clean_sheets', '$goals_conceded')";
if (mysqli_query($con,$sql) === TRUE) {
echo '<script type="text/javascript">alert("New Player Added")</script>';
header("Location: add_player.php");
} else {
echo "Error: " . $sql . "<br>" . $con->error;
}
$con->close();
?>