Reply to Re: [PHP] php: "else if" problem

Your name:

Reply:


Posted by Franklin van de Meent on 10/02/78 11:11

In PHP you should write it as "} elseif {", so there's no space
between else and if.

Read http://php.net/elseif for more details



On Tue, 22 Mar 2005 22:48:00 +0200, Leonidas Savvides
<a080725@cytanet.com.cy> wrote:
> to: 'php-general@lists.php.net'
>
> from: Leonidas Savvides
>
> Please see my problem below in PHP code :
> _____
>
> <?php
> echo $month, $day, $year, $month2, $day2, $year2; // these are
> ok-normal values from web form
> if ( ! @checkdate($month,$day,$year) ) {
> echo "this operate till here"; // include_once
> ("normaldays.php"); @ // wrongpickupdate.htm
> } else if ( ! @checkdate($month2,$day2,$year2) ) {
> include_once ("wrongdropoffdate.htm");
> } else if ( $tsp < $tsnow ) { // "$tsp"=time stamp
> pickup date
> include_once ("wrongpickupdate.htm"); // include_once
> ("normaldays.php"); // wrongpickupdate.htm
> } else if ( $tsp >= $tsd ) { // "$tsd"=time stamp drop
> off date
> include_once ("wrongpickupdate.htm");
> } else if ( $days >= 60 ) { // "$days" var come from
> "$tsd" & "$tsp"
> include_once ("manydays.htm");
> } else if ( $days <= 2 ) {
> include_once ("fewdays.htm");
> } else {
> include_once ("normaldays.php");
> }
>
> ?>
> _____
>
> problem
>
> 1. executes first statement what ever vars are
> 2. if no "!" to first statement , executes second statement
> 3. if no "!" to first & second statement, executes first
> include_once() statement meaning :
> } else if ( $tsp < $tsnow ) {
> include_once ("wrongpickupdate.htm");
> }
> whatever values of $tsp & $tsnow are .
>
> well WHERE THE PROBLEM IS ?
> * <mailto:a080725@cytanet.com.cy> a080725@cytanet.com.cy
> *
> <http://us.f610.mail.yahoo.com/ym/Compose?To=info@L-computers.com>
> info@L-computers.com
> * Leonidas Savvides
>
>

[Back to original 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

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