944,008 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 1970
  • PHP RSS
Sep 8th, 2007
0

Advanced verification on error checking

Expand Post »
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!
Last edited by JeniF; Sep 8th, 2007 at 11:47 am.
Similar Threads
Reputation Points: 10
Solved Threads: 5
Junior Poster in Training
JeniF is offline Offline
52 posts
since Aug 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: can't open php pages
Next Thread in PHP Forum Timeline: Help with php and this part of the code...?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC