I'm working on a website where people can sign up for an event. We've got 8 different teams, based on superhero's. Every team should choose 1 of the 8 superhero's, but non of them should choose the same one.
Is it possible to write some code to disable an option (for every new visitor of the website) after someone has chosen that superhero?
So if 2 people has chosen a superhero, there will only be 6 choices left. These six will be visable, but non-clickable.
So my html form code is (some titles/names are Dutch;)):
<form action="inschrijfformulier.php" method="post" id="cc-m-form-6876142651" target="_blank" class="cc-m-form cc-m-form-layout-1" onsubmit="javascript: setTimeout(function(){location.reload();}, 1000);return true;">
<div class="cc-m-form-loading"></div>
<div class="cc-m-form-view-sortable">
<div class="cc-m-form-view-element cc-m-form-select" data-action="element" required>
<label for="ma6b8be54cf86a6410">
<div>Kies welke held jouw team is!</div>
</label>
<div class="cc-m-form-view-input-wrapper">
<select name="teamnaam" class="cc-m-form-element-input" required>
<option value="" selected disabled hidden>Selecteer</option>
<option value="Superman">Superman</option>
<option value="Batman">Batman</option>
<option value="X-Men">X-Men</option>
<option value="MegaMindy">Mega Mindy</option>
<option value="Spiderman">Spiderman</option>
<option value="TheHulk">The Hulk</option>
<option value="HitGirl">Hit Girl</option>
<option value="Meerminman">Meerminman</option></select></div></div>
<input type="submit" value="Naar betalen" data-action="formButton">
So if you make a selection and submit the form, it wil link to inschrijfformulie.php, this .php file contains:
<?php
$name = $_POST['teamnaam'];
$email = $_POST['email'];
$rekeninghouder = $_POST['rekeninghouder'];
$aantalspelers = $_POST['aantalspelers'];
$spelernamen = $_POST['spelernamen'];
$formcontent="Teamnaam: $name
Email: $email
Rekeninghouder: $rekeninghouder
Aantal spelers: $aantalspelers
Spelers: $spelernamen";
$recipient = "info@sidekickevents.nl";
$subject = "Inschrijfformulier";
$mailheader = "From: $email
";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
header("Location: https://www.ticketkantoor.nl/shop/bubbelvoetbal");
exit;
?>
This makes sure that i'm getting an email with the information they fill in. This works great, I also can see wich superhero they've chosen. Hopefully someone can explain it, because i'm new to php! Thanks in advance!