|
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;">"<?php echo $_SESSION['phrase']; ?>"</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;">"<?php echo $_SESSION['font_type']; ?>"</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';
}
?>
[Back to original message]
|