Skip to content

Commit

Permalink
Added the core logic behind the submit button.
Browse files Browse the repository at this point in the history
All we need to do is to test with a few variables to see if SQL insert function actually submits to the database. Will do that Tomorrow.
  • Loading branch information
b2af committed Sep 20, 2024
1 parent 532a74f commit 91ef10c
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 10 deletions.
45 changes: 44 additions & 1 deletion RDL/ReportHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,54 @@ function getPilot(){

}
}
}



function SubmitReport($PilotName, $WinnerScore, $WinnerSuicides, $LoserSuicides, $LoserScore, $Comments, $Level, $MatchID, $RecordingLink, $TrackerLink )
{

include '../DBConnector.php';



$PilotName = $_POST['$PilotName'];
$WinnerScore = $_POST['$WinnerSuicides'];
$LoserSuicides = $_POST['$LoserSuicides'];
$LoserScore = $_POST['$LoserScore'];
$MatchID = $_POST['$MatchID'];

$sqlPilot = "INSERT INTO Player (PilotName, WinnerScore, WinnerSuicides, LoserSuicides, LoserScore, MatchId) VALUES ('$PilotName', '$WinnerScore', '$WinnerSuicides', '$LoserSuicides', '$LoserScore $MatchID)";

$result = $connection -> query($sql);


if(isset($_POST["submit"])){

echo "Success";
}


/*
$sqlMatch = "INSERT INTO Match (PilotName, WinnerScore, WinnerSuicides, LoserSuicides, LoserScore, Comments, Level, RecordingLink, TrackerLink)
VALUES ('$pilot', '$WinnerScore', '$WinnerSuicides', '$LoserSuicides', '$LoserScore', '$Comments', '$Level', '$RecordingLink', '$TrackerLink')";
$PilotName = $_POST['$PilotName'];
$WinnerScore = $_POST['$PilotName'];
$WinnerSuicides = $_POST['$PilotName'];
$LoserSuicides = $_POST['$PilotName'];
$LoserScore = $_POST['$PilotName'];
$Comments = $_POST['$PilotName'];
$Level = $_POST['$PilotName'];
$RecordingLink = $_POST['$PilotName'];
$TrackerLink = $_POST['$PilotName'];
"*/

}


}



19 changes: 10 additions & 9 deletions RDL/rdl-report-solo.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ function validateInput(input) {
<br>
<br>
<br>

<div class="hrcontainer2">
<div class="label">
<h3>
Expand All @@ -89,12 +90,12 @@ function validateInput(input) {

</select>
</div>
<div class="label score-label">
<div class="label score-label" Name = "WinnerScore">
<span>Score:&nbsp;&nbsp;</span> <input onblur="if(this.value === '') { this.value = 'XX'; this.classList.add('grey-placeholder'); }" onfocus=
"if(this.value === 'XX') { this.value = ''; this.classList.remove('grey-placeholder'); }" oninput="validateInput(this)" style=
"width: 30px; text-align: center; font-size: 16px; color: gray; border-radius: 5px;" type="text" value="XX">
</div>
<div class="label suicides-label">
<div class="label suicides-label" Name = "WinnerSuicides">
<span>Suicides:&nbsp;&nbsp;</span> <input onblur="if(this.value === '') { this.value = 'XX'; this.classList.add('grey-placeholder'); }" onfocus=
"if(this.value === 'XX') { this.value = ''; this.classList.remove('grey-placeholder'); }" oninput="validateInput(this)" style=
"width: 30px; text-align: center; font-size: 16px; color: gray; border-radius: 5px;" type="text" value="XX">
Expand All @@ -114,12 +115,12 @@ function validateInput(input) {
<div class="label">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;You&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</div>
<div class="label score-label">
<div class="label score-label" Name="LoserScore">
<span>Score:&nbsp;&nbsp;</span> <input onblur="if(this.value === '') { this.value = 'XX'; this.classList.add('grey-placeholder'); }" onfocus=
"if(this.value === 'XX') { this.value = ''; this.classList.remove('grey-placeholder'); }" oninput="validateInput(this)" style=
"width: 30px; text-align: center; font-size: 16px; color: gray; border-radius: 5px;" type="text" value="XX">
</div>
<div class="label suicides-label">
<div class="label suicides-label" Name="LoserSuicides">
<span>Suicides:&nbsp;&nbsp;</span> <input onblur="if(this.value === '') { this.value = 'XX'; this.classList.add('grey-placeholder'); }" onfocus=
"if(this.value === 'XX') { this.value = ''; this.classList.remove('grey-placeholder'); }" oninput="validateInput(this)" style=
"width: 30px; text-align: center; font-size: 16px; color: gray; border-radius: 5px;" type="text" value="XX">
Expand All @@ -135,7 +136,7 @@ function validateInput(input) {
<div style="display: flex; justify-content: center; align-items: center;">
<div style="text-align: center; color: white; font-family: Tahoma, Arial, sans-serif; background-color: transparent; padding: 15px; border-radius: 10px; width: 400px; margin-right: 20px;">
<div style="display: flex; align-items: center">
<label for="comment">Comment:</label>
<label for="comment" Name="Comment">Comment:</label>
<div class="commentbox" id="level" style="type=&quot;text&quot;; border-radius: 5px; padding: 50px; margin-left: -7px; width: 300px; resize: none">
<textarea class="cols=&quot;100&quot;" rows="10" style="resize: none; width: 300px"></textarea>
</div>
Expand All @@ -144,25 +145,25 @@ function validateInput(input) {

<div style="display: flex; justify-content: center; align-items: center;">
<div style="text-align: center; color: white; font-family: Tahoma, Arial, sans-serif; font-size: 13px; background-color: transparent none; padding: 10px; border-radius: 10px; width: 250px;">
<label for="level">Level:</label> <input id="level" placeholder="Enter level" style="border-radius: 5px; padding: 5px;" type="text">
<label for="level" Name="Level">Level:</label> <input id="level" placeholder="Enter level" style="border-radius: 5px; padding: 5px;" type="text" name="level" method="post"
</div>
</div>

<div style="display: flex; justify-content: center; align-items: center; color: white; font-size: 13px; margin-right:10px;">
<label for="level" style="display: flex; align-items: center;">Recording Link:&nbsp;&nbsp;</label>
<label for="level" Name="RecordingLink"style="display: flex; align-items: center;">Recording Link:&nbsp;&nbsp;</label> <!--Check the name syntax-->
<input id="level" placeholder="(This is optional)" style="border-radius: 5px; padding: 5px;" type="text ">
</div>


<div style="display: flex; justify-content: center; align-items: center; color: white; font-size: 13px; margin-right: 10px;">
<label for="level" style="display: flex; align-items: center;">Tracker Link:&nbsp;&nbsp;</label>
<label for="level" Name="TrackerLink" style="display: flex; align-items: center;" >Tracker Link:&nbsp;&nbsp;</label>
<input id="level" placeholder="(This is not optional)" class="red-text" type="text">
</div>
</div>
</div>

<div style="display: flex; justify-content: center; align-items: center;">
<button style="padding: 15px 30px; border-radius: 5px; background-color: #333; color: white; font-family: Tahoma, Arial, sans-serif; font-size: 18px;" type="submit">Submit</button>
<button style="padding: 15px 30px; border-radius: 5px; background-color: #333; color: white; font-family: Tahoma, Arial, sans-serif; font-size: 18px;" type="Submit">Submit</button>

<br>
<br>
Expand Down

0 comments on commit 91ef10c

Please sign in to comment.