| | |
Advanced verification on error checking
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
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:
any help or suggestions would be greatly appreciated!
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.
I keep hitting "escape", but I'm still here!!!!
:}
:}
![]() |
Similar Threads
- Custom error checking (C#)
- error checking (Java)
- User Form error checking (PHP)
- Help with 1.pointers and 2.error checking (C++)
- Error Checking for user input (Java)
- error checking of user input (C++)
- Basic Error Checking (C++)
- How to Perform Disk Error Checking in Windows XP (Windows tips 'n' tweaks)
Other Threads in the PHP Forum
- Previous Thread: can't open php pages
- Next Thread: Comparing two arrays problem
| Thread Tools | Search this Thread |
ajax apache api array beginner beneath binary broadband broken button cakephp checkbox class cms code countingeverycharactersfromastring crack cron curl database date decode display dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link login loop mail match md5 menu mlm multiple mysql mysql_real_escape_string oop paypal pdf php problem protocol query radio random recursion regex remote script search server session sessions sms smtp soap source space sql strip_tags survey syntax system table tutorial undefined update upload url validator variable video virus votedown web window.onbeforeunload=closeme; xml youtube





