<commit_before><script>
    function validateForm() {
        $("small").remove();
        var isFormValid = true;
        $(".required input").each(function() {
            if ($.trim($(this).val()).length == 0) {
                $(this).parent().addClass("error");
                $(this).parent().append('<small>Invalid entry</small>');
                isFormValid = false;
            } else {
                $(this).parent().removeClass("error");
                $(this).parent().remove("small");
            }
        });
        $(".required select").each(function() {
            if(!$(this).val()) {
                $(this).parent().addClass("error");
                $(this).parent().append('<small>Invalid entry</small>');
                isFormValid = false;
            } else {
                $(this).parent().removeClass("error");
                $(this).parent().remove("small");
            }
        });
        return isFormValid;
    }
</script>
<div class="large-6 columns large-centered">
    <form class="survey" name="survey" action="" method="post" onsubmit="return validateForm()">
      <fieldset>
        <legend>Player Survey</legend>

        <div class="row required">
            <div class="large-6 columns">
                <label>Name</label>
                <input type="text" name="name" maxlength="70" autocomplete="off" autofocus required>
            </div>
        </div>

        <div class="row required">
            <div class="large-6 columns">
                <label>Email</label>
                <input type="email" name="email" maxlength="50" required>
            </div>
        </div>

        <div class="row required">
            <div class="large-4 columns">
                <label for="customDropdown">Gender</label>
                <select id="customDropdown" name="gender" required>
                    <option></option>
                    <option>Male</option>
                    <option>Female</option>
                    <option>Prefer not to say</option>
                </select>
            </div>
        </div>

        <div class="row required">
            <div class="large-4 columns">
                <label for="customDropdown">Age</label>
                <select id="customDropdown" name="age" required>
                    <option></option>
                    <option>Under 11</option>
                    <option>12-17</option>
                    <option>18-24</option>
                    <option>25-34</option>
                    <option>35-44</option>
                    <option>45-54</option>
                    <option>55-64</option>
                    <option>65-74</option>
                    <option>75 years or older</option>
                </select>
            </div>
        </div>

        <div class="row">
            <div class="large-4 columns submit-button">
                <input class="nice blue radius button" type="submit" name="Submit" value="Submit">
            </div>
        </div>

      </fieldset>
    </form>
</div>

<?php

if (isset($_POST['Submit'])) { 

    setcookie('survey_complete', true, 5184000 + time());
    setcookie('survey_name', $_POST['name'], 5184000 + time());
    setcookie('survey_email', $_POST['email'], 5184000 + time());
    setcookie('survey_gender', $_POST['gender'], 5184000 + time());
    setcookie('survey_age', $_POST['age'], 5184000 + time());

    header('Location: '.$_SERVER['REQUEST_URI']);
} 

?> <commit_msg>Make email non-mandatory and add ethnicity<commit_after><script>
    function validateForm() {
        $("small").remove();
        var isFormValid = true;
        $(".required input").each(function() {
            if ($.trim($(this).val()).length == 0) {
                $(this).parent().addClass("error");
                $(this).parent().append('<small>Invalid entry</small>');
                isFormValid = false;
            } else {
                $(this).parent().removeClass("error");
                $(this).parent().remove("small");
            }
        });
        $(".required select").each(function() {
            if(!$(this).val()) {
                $(this).parent().addClass("error");
                $(this).parent().append('<small>Invalid entry</small>');
                isFormValid = false;
            } else {
                $(this).parent().removeClass("error");
                $(this).parent().remove("small");
            }
        });
        return isFormValid;
    }
</script>
<div class="large-6 columns large-centered">
    <form class="survey" name="survey" action="" method="post" onsubmit="return validateForm()">
      <fieldset>
        <legend>Player Survey</legend>

        <div class="row required">
            <div class="large-6 columns">
                <label>Name</label>
                <input type="text" name="name" maxlength="70" autocomplete="off" autofocus required>
            </div>
        </div>

        <div class="row">
            <div class="large-6 columns">
                <label>Email</label>
                <input type="email" name="email" maxlength="50">
            </div>
        </div>

        <div class="row required">
            <div class="large-4 columns">
                <label for="customDropdown">Gender</label>
                <select id="customDropdown" name="gender" required>
                    <option></option>
                    <option>Male</option>
                    <option>Female</option>
                </select>
            </div>
        </div>

        <div class="row required">
            <div class="large-4 columns">
                <label for="customDropdown">Ethnicity</label>
                <select id="customDropdown" name="ethnicity" required>
                    <option></option>
                    <option>American Indian or Alaska Native</option>
                    <option>Asian</option>
                    <option>Black or African American</option>
                    <option>Hispanic or Latino</option>
                    <option>Native Hawaiian or Pacific Islander</option>
                    <option>White</option>
                    <option>Other</option>
                    <option>Prefer not to say</option>
                </select>
            </div>
        </div>

        <div class="row required">
            <div class="large-4 columns">
                <label for="customDropdown">Age</label>
                <select id="customDropdown" name="age" required>
                    <option></option>
                    <option>Under 11</option>
                    <option>12-17</option>
                    <option>18-24</option>
                    <option>25-34</option>
                    <option>35-44</option>
                    <option>45-54</option>
                    <option>55-64</option>
                    <option>65-74</option>
                    <option>75 years or older</option>
                </select>
            </div>
        </div>

        <div class="row">
            <div class="large-4 columns submit-button">
                <input class="nice blue radius button" type="submit" name="Submit" value="Submit">
            </div>
        </div>

      </fieldset>
    </form>
</div>

<?php

if (isset($_POST['Submit'])) { 

    setcookie('survey_complete', true, 5184000 + time());
    setcookie('survey_name', $_POST['name'], 5184000 + time());
    setcookie('survey_email', $_POST['email'], 5184000 + time());
    setcookie('survey_gender', $_POST['gender'], 5184000 + time());
    setcookie('survey_age', $_POST['age'], 5184000 + time());
    setcookie('survey_ethnicity', $_POST['ethnicity'], 5184000 + time());

    header('Location: '.$_SERVER['REQUEST_URI']);
} 

?> 
{'fraction_non_alphanumeric': 0.16310125761701025, 'fraction_numerical': 0.02126280305976922, 'mean_word_length': 1.66, 'pattern_counts': {'":': 0, '<': 183, '<?xml version=': 0, '>': 183, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '569495', 'n_tokens_mistral': 2204, 'n_tokens_neox': 1983, 'n_words': 389}