473,403 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

If, And, Or code for data entry

I have a drop down box with 'Incomplete', 'Resolved' and 'Complete' as
part of my $status variable on a form and a text box called
'$datecomp' that passes the data from both variables to a MySQL
database.

How might I include an 'if' statement where if the drop down selection
for variable $datecomp is 'Incomplete' or 'Resolved', an error message
is displayed on the data entry confirmation page that requests the
user to click their browser 'back' button and enter a date in the
'datecomp' field? I was trying to modify the following code but so
far, without any luck. In other words, if 'status' = Complete or
Resolved, trigger the error on the confirmation page where a user
clicks their back button and either enters a date in the datecomp
field OR leaves the drop down box as Incomplete.

thanks,
John

if (!$datecomp || and $status="Complete" or "Resolved")
{
echo 'You must enter a DATE for items marked Complete or
Resolved.<br />'
.'Please click the browser BACK button, fill in a Complete/
Resolved date and try again.';
exit;
}

Jun 14 '07 #1
4 1440
On Jun 13, 7:23 pm, j...@lycos.com wrote:
I have a drop down box with 'Incomplete', 'Resolved' and 'Complete' as
part of my $status variable on a form and a text box called
'$datecomp' that passes the data from both variables to a MySQL
database.

How might I include an 'if' statement where if the drop down selection
for variable $datecomp is 'Incomplete' or 'Resolved', an error message
is displayed on the data entry confirmation page that requests the
user to click their browser 'back' button and enter a date in the
'datecomp' field? I was trying to modify the following code but so
far, without any luck. In other words, if 'status' = Complete or
Resolved, trigger the error on the confirmation page where a user
clicks their back button and either enters a date in the datecomp
field OR leaves the drop down box as Incomplete.

thanks,
John

if (!$datecomp || and $status="Complete" or "Resolved")
{
echo 'You must enter a DATE for items marked Complete or
Resolved.<br />'
.'Please click the browser BACK button, fill in a Complete/
Resolved date and try again.';
exit;
}

Solved this puzzle (though it may not be the best example of code
writing) and thought I'd put the solution here in hopes of helping
someone else in a similar bind.. :-)

if ((($status == "Complete") or ($status == "Resolved") and ($datecomp
== "")))
{
echo 'All items marked COMPLETE or RESOLVED must have a date
entered.<br />'
.'Please click the browser BACK button, fill in the date and
try again.';
exit;
}

Jun 14 '07 #2
jc***@lycos.com wrote:
I have a drop down box with 'Incomplete', 'Resolved' and 'Complete' as
part of my $status variable on a form and a text box called
'$datecomp' that passes the data from both variables to a MySQL
database.

How might I include an 'if' statement where if the drop down selection
for variable $datecomp is 'Incomplete' or 'Resolved', an error message
is displayed on the data entry confirmation page that requests the
user to click their browser 'back' button and enter a date in the
'datecomp' field? I was trying to modify the following code but so
far, without any luck. In other words, if 'status' = Complete or
Resolved, trigger the error on the confirmation page where a user
clicks their back button and either enters a date in the datecomp
field OR leaves the drop down box as Incomplete.

thanks,
John

if (!$datecomp || and $status="Complete" or "Resolved")
{
echo 'You must enter a DATE for items marked Complete or
Resolved.<br />'
.'Please click the browser BACK button, fill in a Complete/
Resolved date and try again.';
exit;
}
if (!$datecomp && ($status == 'Complete' || $status == 'Resolved'))
....use '=' for assignment and '==' for comparison.

Norm
Jun 14 '07 #3
>I have a drop down box with 'Incomplete', 'Resolved' and 'Complete' as
>part of my $status variable on a form and a text box called
'$datecomp' that passes the data from both variables to a MySQL
database.
The variable passed to PHP is $_GET['datecomp'] or $_POST['datecomp'],
not $datecomp. (register_globals is evil and should be turned off).
>How might I include an 'if' statement where if the drop down selection
for variable $datecomp is 'Incomplete' or 'Resolved', an error message
is displayed on the data entry confirmation page that requests the
user to click their browser 'back' button and enter a date in the
'datecomp' field? I was trying to modify the following code but so
far, without any luck. In other words, if 'status' = Complete or
Resolved, trigger the error on the confirmation page where a user
clicks their back button and either enters a date in the datecomp
field OR leaves the drop down box as Incomplete.
There's no meaning to a subexpression like: "Complete" or "Resolved".
Think of it as: If status is Complete or status is Resolved, then ....
>thanks,
John

if (!$datecomp || and $status="Complete" or "Resolved")
if (isset($_GET['datecomp'] && ($_GET['status'] == "Complete" || $_GET['status'] == "Resolved"))
{
echo 'You must enter a DATE for items marked Complete or
Resolved.<br />'
.'Please click the browser BACK button, fill in a Complete/
Resolved date and try again.';
exit;
}

Jun 14 '07 #4
On Jun 13, 9:04 pm, gordonb.ic...@burditt.org (Gordon Burditt) wrote:
I have a drop down box with 'Incomplete', 'Resolved' and 'Complete' as
part of my $status variable on a form and a text box called
'$datecomp' that passes the data from both variables to a MySQL
database.

The variable passed to PHP is $_GET['datecomp'] or $_POST['datecomp'],
not $datecomp. (register_globals is evil and should be turned off).
How might I include an 'if' statement where if the drop down selection
for variable $datecomp is 'Incomplete' or 'Resolved', an error message
is displayed on the data entry confirmation page that requests the
user to click their browser 'back' button and enter a date in the
'datecomp' field? I was trying to modify the following code but so
far, without any luck. In other words, if 'status' = Complete or
Resolved, trigger the error on the confirmation page where a user
clicks their back button and either enters a date in the datecomp
field OR leaves the drop down box as Incomplete.

There's no meaning to a subexpression like: "Complete" or "Resolved".
Think of it as: If status is Complete or status is Resolved, then ....
thanks,
John
if (!$datecomp || and $status="Complete" or "Resolved")

if (isset($_GET['datecomp'] && ($_GET['status'] == "Complete" || $_GET['status'] == "Resolved"))
{
echo 'You must enter a DATE for items marked Complete or
Resolved.<br />'
.'Please click the browser BACK button, fill in a Complete/
Resolved date and try again.';
exit;
}

Thanks very much for your help guys - appreciate it!

Jun 15 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: | last post by:
Hi, I am an intermediate computer science student and I am in need of a "macro type" tool/language that will let me automate a data entry process. The data entry is rather simple but requires...
2
by: Iain Miller | last post by:
Struggling a bit here & would be grateful for any help. I have a table which has a list of people in it. Each person has a unique ID automatically allocated by Access but also belongs to one of 5...
5
by: Nancy | last post by:
I have two tables: TblCourse CourseID CourseName TblClass ClassID CourseID ClassDate
0
by: tamilan71 | last post by:
Can anyone tell me a simple method of creating an application in Access 2003 that uses "Double data entry"? For me double data entry is defined as the ability to have data entered twice. The first...
2
by: filbennett | last post by:
Hi Everyone, I'm generally unfamiliar with Access form design, but have programmed Cold Fusion applications for a couple of years. I'd like to build a data entry form in Access that allows the...
20
by: hippomedon | last post by:
Hello everyone, I'm looking for some advice on whether I should break the normalization rule. Normally, I would not consider it, but this seems to be a special case. I have created an...
1
by: admin.offshoredataentry | last post by:
Data Entry Outsourcing provides time bound, cost effective and qualitative Data Entry also provides numeric data entry, textual data entry, image data entry, data format, data conversion and also...
1
by: Data Entry Outsourcing | last post by:
Data Entry plays vital role in every business area. Data Entry is one such aspects of any business that needs to be handled properly for expanding your business. Data Entry is one of the leading...
0
by: dataentryoffshore | last post by:
Get a Discount up to 60% on data entry, data capture, dataentry services, large volume data processing and data conversion services through offshore facilities in India. Offshore data entry also...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.