| Current Path : /var/www/cesa.co.za/php/ |
| Current File : /var/www/cesa.co.za/php/jobshadowschools.php |
<?php
$bShowForm = true;
$bError = false;
$sErrors = "";
if (isset($_POST["go"]) && ($_POST["go"] == 1)) {
include("inc_db.php");
if (!reCaptcha($_POST["g-recaptcha-response"])) {
$sErrors .= "<li>You could not be verified as not being a robot, please tick the reCaptcha verification option at the bottom of the form.</li>";
$bError = true;
} else {
if (empty($_POST["SchoolName"])) {
$sErrors .= "<li>School name is required</li>";
$bError = true;
}
if (empty($_POST["SchoolType"])) {
$sErrors .= "<li>School type is required</li>";
$bError = true;
}
if (empty($_POST["Province"])) {
$sErrors .= "<li>Province is required</li>";
$bError = true;
}
if (empty($_POST["City"])) {
$sErrors .= "<li>City is required</li>";
$bError = true;
}
if (empty($_POST["Principal"])) {
$sErrors .= "<li>Principal's name is required</li>";
$bError = true;
}
if (empty($_POST["Email"])) {
$sErrors .= "<li>Email address is required</li>";
$bError = true;
}
}
if ($bError) {
echo "<p><b style='color:red'>NB: Your information has NOT been saved, please correct the following errors and re-submit:</b><br>
<ul>" . $sErrors . "</ul></p>";
$bShowForm = true;
} else {
$sql = "INSERT INTO JSSchools (SchoolName, SchoolType, Province, Street, Suburb, City, Website, Principal, Telephone, Cell, Fax, Email, OtherContact, Telephone2, Cell2, Fax2, Email2, Section21, Dinaledi) VALUES ('" . addslashes($_POST["SchoolName"]) . "', '" . addslashes($_POST["SchoolType"]) . "', '" . addslashes($_POST["Province"]) . "', '" . addslashes($_POST["Street"]) . "', '" . addslashes($_POST["Suburb"]) . "', '" . addslashes($_POST["City"]) . "', '" . addslashes($_POST["Website"]) . "', '" . addslashes($_POST["Principal"]) . "', '" . addslashes($_POST["Telephone"]) . "', '" . addslashes($_POST["Cell"]) . "', '" . addslashes($_POST["Fax"]) . "', '" . addslashes($_POST["Email"]) . "', '" . addslashes($_POST["OtherContact"]) . "', '" . addslashes($_POST["Telephone2"]) . "', '" . addslashes($_POST["Cell2"]) . "', '" . addslashes($_POST["Fax2"]) . "', '" . addslashes($_POST["Email2"]) . "', '" . addslashes($_POST["Section21"]) . "', '" . addslashes($_POST["Dinaledi"]) . "')";
mysql_query($sql);
echo "<p><b>Thank you for submitting your information, it has been added to our database.</b></p>";
$bShowForm = false;
}
}
if ($bShowForm) {
?>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<p>Please enter your school information below:</p>
<form method="post" action="/node/407">
<input type="hidden" name="go" value="1">
<table border="1" cellpadding="5" cellspacing="0">
<tbody>
<tr>
<td><b>School Name:</b></td>
<td><input name="SchoolName" type="text" id="SchoolName" size="40" value="<?php echo $_POST["SchoolName"]; ?>" /></td>
</tr>
<tr>
<td><b>School Type:</b></td>
<td><select name="SchoolType" id="SchoolType">
<option value="">Please select...</option>
<option value="Primary" <?php if ($_POST["SchoolType"] == "Primary") echo " selected"; ?>>Primary</option>
<option value="Secondary" <?php if ($_POST["SchoolType"] == "Secondary") echo " selected"; ?>>Secondary</option>
<option value="Combined" <?php if ($_POST["SchoolType"] == "Combined") echo " selected"; ?>>Combined</option>
</select></td>
</tr>
<tr>
<td><b>Province:</b></td>
<td><select name="Province" id="Province">
<option value="">Please select...</option>
<option value="Eastern Cape">Eastern Cape</option>
<option value="Free State">Free State</option>
<option value="Gauteng">Gauteng</option>
<option value="KwaZulu-Natal">KwaZulu-Natal</option>
<option value="Limpopo">Limpopo</option>
<option value="Mpumalanga">Mpumalanga</option>
<option value="North-West">North-West</option>
<option value="Northern Cape">Northern Cape</option>
<option value="Western Cape">Western Cape</option>
</select></td>
</tr>
<tr>
<td><b>Street:</b></td>
<td><input name="Street" type="text" id="Street" size="40" value="<?php echo $_POST["Street"]; ?>" /></td>
</tr>
<tr>
<td><b>Suburb:</b></td>
<td><input name="Suburb" type="text" id="Suburb" size="40" value="<?php echo $_POST["Suburb"]; ?>" /></td>
</tr>
<tr>
<td><b>City:</b></td>
<td><input name="City" type="text" id="City" size="40" value="<?php echo $_POST["City"]; ?>" /></td>
</tr>
<tr>
<td><b>Website:</b></td>
<td><input name="Website" type="text" id="Website" size="40" value="<?php echo $_POST["Website"]; ?>" /></td>
</tr>
<tr>
<td><b>Principal Name:</b></td>
<td><input name="Principal" type="text" id="Principal" size="40" value="<?php echo $_POST["Principal"]; ?>" /></td>
</tr>
<tr>
<td><b>Telephone:</b></td>
<td><input name="Telephone" type="text" id="Telephone" size="40" value="<?php echo $_POST["Telephone"]; ?>" /></td>
</tr>
<tr>
<td><b>Cell:</b></td>
<td><input name="Cell" type="text" id="Cell" size="40" value="<?php echo $_POST["Cell"]; ?>" /></td>
</tr>
<tr>
<td><b>Fax:</b></td>
<td><input name="Fax" type="text" id="Fax" size="40" value="<?php echo $_POST["Fax"]; ?>" /></td>
</tr>
<tr>
<td><b>Email:</b></td>
<td><input name="Email" type="text" id="Email" size="40" value="<?php echo $_POST["Email"]; ?>" /></td>
</tr>
<tr>
<td><b>Other Contact Name:</b></td>
<td><input name="OtherContact" type="text" id="OtherContact" size="40" value="<?php echo $_POST["OtherContact"]; ?>" /></td>
</tr>
<tr>
<td><b>Telephone:</b></td>
<td><input name="Telephone2" type="text" id="Telephone2" size="40" value="<?php echo $_POST["Telephone2"]; ?>" /></td>
</tr>
<tr>
<td><b>Cell:</b></td>
<td><input name="Cell2" type="text" id="Cell2" size="40" value="<?php echo $_POST["Cell2"]; ?>" /></td>
</tr>
<tr>
<td><b>Fax:</b></td>
<td><input name="Fax2" type="text" id="Fax2" size="40" value="<?php echo $_POST["Fax2"]; ?>" /></td>
</tr>
<tr>
<td><b>Email:</b></td>
<td><input name="Email2" type="text" id="Email2" size="40" value="<?php echo $_POST["Email2"]; ?>" /></td>
</tr>
<tr>
<td><strong>Section 21:</strong></td>
<td><input name="Section21" type="radio" value="1" <?php if ($_POST["Section21"] == "1") echo " checked"; ?> />Yes <input name="Section21" type="radio" value="0" <?php if (!isset($_POST["Section21"]) || ($_POST["Section21"] == "0")) echo " checked"; ?> />No</td>
</tr>
<tr>
<td><strong>Dinaledi:</strong></td>
<td><input name="Dinaledi" type="radio" value="1" <?php if ($_POST["Dinaledi"] == "1") echo " checked"; ?> />Yes <input name="Dinaledi" type="radio" value="0" <?php if (!isset($_POST["Dinaledi"]) || ($_POST["Dinaledi"] == "0")) echo " checked"; ?> />No</td>
</tr>
<tr>
<td colspan="2" style="text-align: center; ">
<div class="g-recaptcha" data-sitekey="6LcoIWUrAAAAAKBLHpjS7GyroBey9G6yhilbpyNa"></div>
<input name="Submit" type="submit" value="Submit" />
</td>
</tr>
</tbody>
</table>
</form>
<?php
}
?>