connect_error) { exit("Connection failed: " . $conn->connect_error); } if(isset($_GET['check'])) //if check is in the URL then the Athlete has hit submit { $physical = $_POST['physical']; //physical score from the survey $academic = $_POST['academic']; //academic score from the survey $perform = $_POST['perform']; //performace score from the survey $relation = $_POST['relation']; //relationship score from the survey $sleep = $_POST['sleep']; //hours slept from the survey $meeting = $_POST['meeting']; //meeting value from the survey $id = $_POST['id']; //id from the survey $id = strtolower($id); //make sure its lowercase $id = trim($id); //trim any spaces from the id //Query to see if they are in the Athlete_Info table $query = "SELECT * FROM Athlete_Info WHERE A_ID = '{$id}'"; $result = $conn->query($query); if($result->num_rows == 0) //check to see if the survey has been filled out. { //echo ''; //alert the athlete to fill out the page, then loads the survey again //the athlete isn't registered and the register page will be loaded header("Location: register.php?player=".$id); //header("Location: athlete_survey.php?thank=1"); } else { $today = date("Ymd"); //todays date //Query to insert the data into the database //Test_Data uses ID and has the sample data. Athlete_Data uses A_ID and has the real data $query = "INSERT INTO Test_Data (ID, Date, physical, academic, perform, relation, sleep, meeting) VALUES ('{$id}','{$today}','{$physical}', '{$academic}', '{$perform}', '{$relation}', '{$sleep}','{$meeting}')"; //'{$physical}', '{$academic}', '{$perform}', '{$relation}', '{$sleep}','{$meeting}' //Send the data if($conn->query($query) === TRUE)//if the data is sent { header("Location: athlete_survey.php?thank=1"); } else { //an error has occured echo "ERROR: " . $conn . "
" .$conn->error; echo "Please contact your coach if this error persists. "; echo "

Try Again Here

"; } //Close connection $conn->close(); } } if(isset($_GET['thank'])) //if thank is in the URL then the athlete has filled the survey and they are registered { echo 'Thank you for filling out the survey!'; } else //nothing in the URL(or the survey hasn't been filled out) so the survey will be loaded { ?> Survey

Student Athlete Survey

Having trouble answering the question? click the

Please enter your 6-letter id

How physically stressed are you feeling today

(low) (high)

How academically stressed are you feeling today

(low) (high)

How are you performing in your sport

(poorly) (well)

How much are your relationships stressing you out

(low) (high)

How long did you sleep last night

Hours:

Would you like a meeting with your coach