I have a function that’s not returning an error message string. I’m sure I’m not doing something right here. Just trying to concatenate the strings together and return errors:
Function:
function Validate_Register_WBG_Tester($Email, $FullName, $ChatHandle, $Product, $PreferedGenre, $PreviousTester, $AgeGroup, $PlayTime, $Discord, $NDA)
{
$Errors;
if(empty($Email))
{
$Errors = $Errors.' Invalid Email <br />';
}
if(empty($Full_Name))
{
$Errors = $Errors.' Invalid Full Name <br />';
}
if(empty($ChatHandle))
{
$Errors = $Errors.' Invalid Chat Handle <br />';
}
if($Discord === FALSE))
{
$Errors = $Errors.' Discord Is Required <br />';
}
if($NDA === FALSE))
{
$Errors = $Errors.' You Must Except The Terms Of The Non Disclosure Agreement <br />';
}
//Todo Email EXISTS
//Todo Chat Handle Exists
return $Errros(string);
}
Web Page:
<?php
include 'wbg/wbg_web_functions.php';
/* Template Name: WBG Beta Tester Signup */
global $wpdb;
if(isset($_POST['submit']))
{
$Email = (string)($_POST['txtEmail']);
$FullName = (string)($_POST['txtFullName']);
$ChatHandle = (string)($_POST['txtChatHandle']);
$Product = (string)($_POST['dlGame']);
$PreferedGenre = (string)($_POST['dlPreferedGame']);
$PreviousTester = (bool)($_POST['Beta-Tested']);
$AgeGroup = (string)($_POST['dlAgeGroup']);
$PlayTime = (string)($_POST['dlPlayTime']);
$Discord = (bool)($_POST['dlDiscord']);
$NDA = (bool)($_POST['cbNDA']);
echo Validate_Register_WBG_Tester($Email, $FullName, $ChatHandle, $Product, $PreferedGenre, $PreviousTester, $AgeGroup, $PlayTime, $Discord, $NDA);
}
?>
<div style="width: 100%;">
<div style="width: 100%;background-color:#5BCBBC;">
<!-- Banner -->
![White Box Gaming Banner](upload://m0uwdHZQULNwS9G60xUD1fUJNmj.png)
</div>
<div style="width:100%;background-color:#FFFFFF; font-size:40px; color:#C2C2C2;" align="left">
<br><label>WBG Tester Registration</label><br><br>
<form action="" method="post">
<div style="width: 100%;border: padding:60px; font-size:40px; color:#C2C2C2;" align="center">
<div style="width: 100%; padding:25px;">
<div style="width: 30%; height: 100px; float: left;" align="left">
<label>Email</label><br>
<input type="text" name="txtEmail" id="txtEmail" placeholder="Email Address" style="font-size:20px; width: 90%; color:#000000;"/>
</div>
<div style="width: 30%; height: 100px; float: left;" align="left">
<label>Full Name</label><br>
<input type="text" name="txtFullName" id="txtFullName" placeholder="Enter Full Name" style="font-size:20px; width: 90%; color:#000000;"/>
</div>
<div style="width: 30%; height: 100px; float: left;" align="left">
<label>Chat Handle</label><br>
<input type="text" name="txtChatHandle" id="txtChatHandle" placeholder="WBG Chat Handle" style="font-size:20px; width: 90%; color:#000000;"/>
</div>
</div>
<br />
<div style="width: 100%; padding:25px;">
<div style="width: 30%; height: 100px; float: left;" align="left">
<label for="games">Choose A Game:</label>
<select id="games" name="dlGame" style="width:90%;height:50px; font-size:20px; color:#000000;">
<option value="Rune-Master">Rune-Master</option>
<option value="Bugology">Bugology</option>
<option value="Ant-Farms">Ant-Farms</option>
</select>
</div>
<div style="width: 30%; height: 100px; float: left;" align="left">
<label for="pgenre">Prefered Game Genre:</label>
<select id="pgenre" name="dlPreferedGame" style="width:90%;height:50px; font-size:20px; color:#000000;">
<option value="RPG">RPG</option>
<option value="MMORPG">MMORPG</option>
<option value="MMO">MMO</option>
<option value="FPS">FPS</option>
<option value="Puzzle">Puzzle</option>
<option value="Adventure">Adventure</option>
<option value="Hack-N-Slash">Hack-N-Slash</option>
<option value="VR">VR</option>
<option value="MOBA">MOBA</option>
<option value="RTS">RTS</option>
<option value="Sports">Sports</option>
<option value="Racing">Racing</option>
<option value="Religious">Religious</option>
<option value="Simulation">Simulation</option>
<option value="RP">RP</option>
<option value="Other">Other</option>
</select>
</div>
<div style="width: 30%; height: 100px; float: left;" align="left">
<label for="ptest">Beta Tested Previously:</label>
<select id="ptest" name="Beta-Tested" style="width:90%;height:50px; font-size:20px; color:#000000;">
<option value="Yes">TRUE</option>
<option value="No">FALSE</option>
</select>
</div>
</div>
<br /><br />
<div style="width: 100%; padding:25px;">
<div style="width: 30%; height: 100px; float: left;" align="left">
<label for="age">Age Group:</label>
<select id="age" name="dlAgeGroup" style="width:90%;height:50px; font-size:20px; color:#000000;">
<option value="10-15">10-15</option>
<option value="16-20">16-20</option>
<option value="21-25">21-25</option>
<option value="26-30">26-30</option>
<option value="31-40">31-49</option>
<option value="40+">40+</option>
</select>
</div>
<div style="width: 30%; height: 100px; float: left;" align="left">
<label for="ptime">Play Time(Hours/Day):</label>
<select id="ptime" name="dlPlayTime" style="width:90%;height:50px; font-size:20px; color:#000000;">
<option value="1-2">1-2</option>
<option value="3-4">3-4</option>
<option value="5+">5+</option>
</select>
</div>
<div style="width: 30%; height: 100px; float: left;" align="left">
<label for="discord">Discord:</label>
<select id="discord" name="dlDiscord" style="width:90%;height:50px; font-size:20px; color:#000000;">
<option value="Yes">Yes</option>
<option value="No">No</option>
</select>
</div>
</div>
<br />
</div>
<!--Agreeemnt-->
<div style="width: 100%; padding:25px;" align="center">
<br /><br /><br /><br />
<label>Non-Disclosure Agreement</label><br />
<a href="https://whiteboxgaming.com/non-disclosure-agreement-rune-master/" target="_blank">Rune Master NDA</a><br />
<input type="checkbox" id="cbNDA" name="cbNDA" value="" style="width:20px;height:20px;"><label>I Have Read The NDA And Agree To The Terms Listed.</label><br /><br />
<input type="submit" id="submit" name="submit" value="Submit Application" style="height:30px; font-size:20px; color:#000000;"/>
</div>
</form>
<br><br><br>
</div>
</div>