Good day to all!
I am working on some error checking and I have run into a snag in my code. Here is what I want to do:
Upon Submit, error check field criteria. This code has to do with posting Internal Job Postitions and based on the dates entered, the postings will display on either our regular website or on our corporate bulletin board. All of that works fine, but upon add if the admin enters a BBPosting Date, they must enter certain other criteria.
ie - if they entered a BBPostingDate, they must enter a facility. that actually works fine in my code. The problem is with a text area. This text are is also calling javascript to copy data from the entry to a hidden field, and I think this may be where the problem lies. I do get the error that they must enter this field, and it it retaining the values on the form, but it is not recognized as being posted in the error checking. here is the error checking code:
$AddData="no";
$MM_flag="MM_insert";
if((isset($_POST["Submit"])) && ($_POST["MM_insert"] == "addPosting")) {
$AddData="yes";
$startWarning="no";
if (!$_POST['Position']
|| !$_POST['Region']
|| !$_POST['Status']
|| !$_POST['PositionPostingNum']
|| !$_POST['PositionStatus']
||($_POST['BBPostingDate'] != NULL && $_POST['BBDeadLine']== NULL)
||($_POST['WSPostingDate'] != NULL && $_POST['WSDeadLine']== NULL)
|| ($_POST['BBPostingDate'] != NULL && $_POST['facility'] == NULL)
|| ($_POST['BBPostingDate'] != NULL && $_POST['InternalPositionQual']==NULL)
|| ($_POST['BBPostingDate'] != NULL && $_POST['InternalPositionEdu'] == NULL)
|| ($_POST['BBPostingDate'] != NULL && $_POST['InternalPositionResp'] == NULL)
)
{
$AddData = "no";
$startWarning="yes";
?>
<?
// if WSPosting Date is not NULL enter the WSDeadLine - display error message
if ($_POST['WSPostingDate'] != NULL && $_POST['WSDeadLine'] == NULL)
{
?>
<div class="warning">
<li>You must enter the Website Dead Line Date if you have entered a Website Posting Date!</li></div>
<?php } ?>
<?
// if no Position Posting Number - display error message
if (!$_POST['PositionPostingNum'])
{ ?>
<div class="warning">
<li>You must enter the Posting Position Number!</li></div>
<?php } ?>
<?
// if no Region - display error message
if (!$_POST['Region'])
{ ?>
<div class="warning">
<li>You must enter the Region!</li></div>
<?php } ?>
<?
// if no Job Position - display error message
if (!$_POST['Position'])
{ ?>
<div class="warning">
<li>You must enter the Job Position!</li></div>
<?php } ?>
<?
// if no Position Status - display error message
if (!$_POST['PositionStatus'])
{ ?>
<div class="warning">
<li>You must enter the Employment Status!</li></div>
<?php } ?>
<?
// if no Class - display error message
if (!$_POST['Class'])
{ ?>
<div class="warning">
<li>You must enter the Employment Classification!</li></div>
<?php } ?>
<?
// if no Facility - display error message
if ($_POST['BBPostingDate'] != NULL && $_POST['facility'] == NULL)
{ ?>
<div class="warning">
<li>You must enter the Facility if you have posted a Bulletin Board Date!</li></div>
<?php } ?>
<?
// if no Service - display error message
if (!$_POST['ServiceCenter'])
{ ?>
<div class="warning">
<li>You must enter the Service Center!</li></div>
<?php } ?>
<?
// if no Work Schedule - display error message
if (!$_POST['WorkSched'])
{ ?>
<div class="warning">
<li>You must enter the Work Schedule!</li></div>
<?php } ?>
<?
// if not selected Internal/External - display error message
if (!$_POST['InternalExternal'])
{ ?>
<div class="warning">
<li>Please tell us if the job information is the same for the Web Site Posting!</li></div>
<?php } ?>
///////////////////////
All works fine until here!
////////////////////////////
<?
// if no Internal Position Qualifications - display error message
if ($_POST['BBPostingDate'] != NULL && !$_POST['InternalPositionQual']==NULL)
{ ?>
<div class="warning">
<li>Because you have entered a Posting Date, you must enter the Qualifications!</li></div>
<?php } ?>
<?
// if no Internal Position Education - display error message
if ($_POST['BBPostingDate'] != NULL && !$_POST['InternalPositionEdu']==NULL)
{ ?>
<div class="warning">
<li>Because you have entered a Posting Date, you must enter the Educational Requirements!</li></div>
<?php } ?>
<?
// if no Internal Position Responsibilities - display error message
if ($_POST['BBPostingDate'] != NULL && !$_POST['InternalPositionResp'] == NULL)
{ ?>
<div class="warning">
<li>Because you have entered a Posting Date, you must enter the Job Responsibilities!</li></div>
<?php } ?>
<?
// if no Status - display error message
if (!$_POST['Status'])
{ ?>
<div class="warning">
<li>You must set the Posting Status to "Active" or "Inactive"!</li></div>
<?php } ?>
<div class="warningend"></div>
<?php
}
else
}
////////////////////////
Here is the textbox code for the 1 of the 3 areas, but basically they are the same(InternalPositionQual, InternalPositionEdu, and InternalPositionResp):
<tr valign="top" id="ExternalPositionQual" style="display:none;" name="ExternalPositionQual">
<th width="234" scope="row"><divalign="left">Qualifications:</div></th>
<th width="503" scope="row"><div align="left">
<textarea name="InternalPositionQual" cols="50" rows="4" id="InternalPositionQual" onChange="copyData(this,document.addPosting.InternalPositionQual2)"
onKeyUp="copyData(this,document.addPosting.InternalPositionQual2)">
<?php if(isset($_POST['InternalPositionQual'])) { echo stripslashes($_POST['InternalPositionQual']); } ?></textarea>
<input name="InternalPositionQual2" type="hidden" value="" />
</div></th>
</tr>
//The actual form submission includes this:
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "addPosting")&& $AddData!="no") {
$insertSQL = sprintf("INSERT INTO jobpostings .......
any help or suggestions would be greatly appreciated!