Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In place of the Age value the table should display a Division column and if the players age is below 18 should show Junior, if

 In place of the Age value the table should display a Division column and if the players age is below 18 should show Junior, if the players age is between 18 and 54 show Adult and if older than 54 show Senior.

3. If the $_POST variable indicates the form was submitted from the delete player form, then use the $_POST variable to retrieve the id of the user to delete and execute a DELETE FROM query to delete the item with the given id from the table

my code:

Add Player Form label {margin: 5px; display: inline-block} td, th {text-align: center; border: solid thin red; padding: 5px} th { font-weight: bold; background: red} able {border-collapse: collapse; margin: 10px} h1, h2 {background:lightblue; display: inline-block} Add a Player to the Roster \" method=\"post\"> Player First Name: Player Last Name: Player Age: Player USTA Ranking: Available to play: Monday Tuesday Wednesday Thursday Friday $dbc = mysqli_connect('localhost','root', '','unit4'); $cmd = \"CREATE TABLE IF NOT EXISTS players\" . \"(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, firstname VARCHAR(12), lastname VARCHAR(12), age INT(2), ranking FLOAT, mon tinyint(1), tue tinyint(1), wed tinyint(1), thur tinyint(1), fri tinyint(1) )\"; mysqli_query($dbc, $cmd); if (isset($_POST['add_player'])) { $firstname = $_POST['firstname']; $lastname = $_POST['lastname']; $age = $_POST['age']; $ranking = $_POST['ranking']; $mon = isset($_POST[\"mon\"]); $tue = isset($_POST[\"tue\"]); $wed = isset($_POST[\"wed\"]); $thur = isset($_POST[\"thur\"]); $fri = isset($_POST[\"fri\"]); $query = \"INSERT INTO players (firstname, lastname, age, ranking, mon, tue, wed, thur, fri)\" . \"VALUES('$firstname', '$lastname', '$age', '$ranking', '$mon', '$tue','$wed', '$thur', '$fri')\"; mysqli_query($dbc, $query); } if (isset($_POST['delete_player'])) { $removename = $_POST[\"removename\"]; $query = \"DELETE FROM players WHERE id='$removename'\"; mysqli_query($dbc, $query); } $query = \"SELECT * FROM players\"; $result = mysqli_query($dbc, $query); echo ' Current Roster'; ?>

while ($row = mysqli_fetch_array($result)) { if($row['mon'] == '1') $row['mon'] = 'X'; else $row['mon'] = ''; if($row['tue'] == '1') $row['tue'] = 'X'; else $row['tue'] = ''; if($row['wed'] == '1') $row['wed'] = 'X'; else $row['wed'] = ''; if($row['thur'] == '1') $row['thur'] = 'X'; else $row['thur'] = ''; if($row['fri'] == '1') $row['fri'] = 'X'; else $row['fri'] = ''; echo ''. ''. ''. ''. ''. ''. ''. ''. ''. ''. ''; } echo '
ID# First Name Last Name Division Monday Tuesday Wednesday Thursday Friday
'.$row['id'].''.$row['firstname'].''.$row['lastname'].''.$row['division'].''.$row['mon'].''.$row['tue'].''.$row['wed'].''.$row['thur'].''.$row['fri'].'
'; mysqli_close($dbc); ?> \" method=\"post\"> Whichplayer do you need to remove? (ID#)




Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions

Question

compare and contrast positivity and negativity;

Answered: 1 week ago

Question

Find the inverse, if it exists, for the matrix. -1

Answered: 1 week ago