You are here: Re: Newbie has more is_null woes « PHP Programming Language « IT news, forums, messages
Re: Newbie has more is_null woes

Posted by Big Moxy on 08/04/07 16:54

On Aug 4, 10:25 am, Big Moxy <bigm...@gmail.com> wrote:
> The while statement shows that the variable phrase is null. However
> the if statements that follow return true because 3 table rows are
> created on my page. I know that isset() is true for phrase however
> given the display output I expect !is_null() to return false and
> therefore leave the if construct. Can someone please tell me why this
> is not happening?
>
> value="^^no^^" name="logo" value="296.06" name="part_sell_price"
> value="" name="phrase" value="script" name="font_type" value="386"
> name="thread_color" value="^^no^^" name="nomex" value="Next >>"
> name="Submit"
>
> <?php
> session_start();
> foreach ($_POST as $key => $value) {
> $_SESSION[$key] = $value;
>
> }
>
> while (list($name, $value) = each($HTTP_POST_VARS))
> {
> echo "value=\"$value\" name=\"$name\"\n";
> }
> ?>
>
> <?php
> if (isset($_SESSION['phrase'])) {
> if (!is_null($_SESSION['phrase'])) {
> if ($_SESSION['phrase'] != "^^no^^") {
> ?>
> <tr>
> <td style="font-family: Verdana, Arial, Helvetica, sans-
> serif; font-size: 14px;"><div align="right"><b>Monogram Color:</b> </
> div></td>
> <td style="font-family: Verdana, Arial, Helvetica, sans-
> serif; font-size: 14px;"><img src="media/embroidery/<?php echo
> $_SESSION['thread_color']; ?>.jpg"></td>
> </tr>
> <tr>
> <td style="font-family: Verdana, Arial, Helvetica, sans-
> serif; font-size: 14px;"><div align="right"><b>Monogram:</b></div></
> td>
> <td style="font-family: Verdana, Arial, Helvetica, sans-
> serif; font-size: 14px;">&quot;<?php echo $_SESSION['phrase']; ?>&quot;</td>
>
> </tr>
> <tr>
> <td style="font-family: Verdana, Arial, Helvetica, sans-
> serif; font-size: 14px;"><div align="right"><b>Font:</b></div></td>
> <td style="font-family: Verdana, Arial, Helvetica, sans-
> serif; font-size: 14px;">&quot;<?php echo $_SESSION['font_type']; ?>&quot;</td>
>
> </tr>
> <?php}
> }
> }
>
> ?>
>
> Thank you!!
> tim

How does empty() compare to the above? I found this at http://us3.php.net/empty
-
<?php
$var = 0;

// Evaluates to true because $var is empty
if (empty($var)) {
echo '$var is either 0, empty, or not set at all';
}

// Evaluates as true because $var is set
if (isset($var)) {
echo '$var is set even though it is empty';
}
?>

 

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

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