I am trying to add a html form to my website that allows for users to select an option from data in my database multiple times, save it as a variable then display the options selected onto the screen.
In my case I am aiming to have the user select 11 players from my database where the position = ST through to where position = GK. And once selected, the form being submitted and then the selected players displayed onto the screen in the same position. I currently have a grid layout setup for the positioning of the player selection and display after. I have multiple players in each position in my database so when selecting a player it would need to allow for all players of that position to be an option. Im sure this is pretty basic but i am new to php and am unsure what the best way to do this would be and could do with some help
I have attempted to do this but recieved errors my code is as follows:
prepare($query);
$stmt->bindParam(':lastname', $lastname);
$stmt->bindParam(':firstname', $firstname);
$stmt->execute();
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) { ?>
On the main page:
The error was:
Fatal error
: Uncaught ArgumentCountError: Too few arguments to function displayST(), 0 passed in /Applications/MAMP/htdocs/assignment/mainPages/dreamTeam.php on line 97 and at least 1 expected in /Applications/MAMP/htdocs/assignment/mainPages/phpFunctions.inc.php:5
Stack trace:
#0 /Applications/MAMP/htdocs/assignment/mainPages/dreamTeam.php(97): displayST()
#1 {main} thrown in
I have attached mock wireframes to explain better what i am trying to achieve, any guidance is appreciated