You are here: Re: If, And, Or code for data entry « PHP Language « IT news, forums, messages
Re: If, And, Or code for data entry

Posted by Norman Peelman on 06/14/07 04:03

jcage@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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация