FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » echo outputs null why?
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
echo outputs null why? [message #180649] Fri, 08 March 2013 01:13 Go to next message
richard is currently offline  richard   
Messages: 213
Registered: June 2013
Karma: 0
Senior Member
http://mroldies.net/urltest.php?rank=1

<?php

$rank=$_GET["rank"];

echo $rank;

if ($rank==1) {
$atitle="A Summer Place";
$cover="1960-001.jpg";
};

echo $atitle;
echo "<img src='http://mroldies.net/covers/$cover'>";

?>

I do not understand why $atitle is not being shown as it should be.

This is just an experiment.
Re: echo outputs null why? [message #180652 is a reply to message #180649] Fri, 08 March 2013 02:35 Go to previous messageGo to next message
David Robley is currently offline  David Robley
Messages: 23
Registered: March 2013
Karma: 0
Junior Member
richard wrote:

> http://mroldies.net/urltest.php?rank=1
>
> <?php
>
> $rank=$_GET["rank"];
>
> echo $rank;
>
> if ($rank==1) {
> $atitle="A Summer Place";
> $cover="1960-001.jpg";
> };
>
> echo $atitle;
> echo "<img src='http://mroldies.net/covers/$cover'>";
>
> ?>
>
> I do not understand why $atitle is not being shown as it should be.
>
> This is just an experiment.

var_dump($_GET);

To see what is there.

--
Cheers
David Robley

Help stamp out, eliminate, and abolish redundancy!
Re: echo outputs null why? [message #180658 is a reply to message #180649] Fri, 08 March 2013 04:36 Go to previous messageGo to next message
richard is currently offline  richard   
Messages: 213
Registered: June 2013
Karma: 0
Senior Member
On Thu, 7 Mar 2013 20:13:48 -0500, richard wrote:

> http://mroldies.net/urltest.php?rank=1
>
> <?php
>
> $rank=$_GET["rank"];
>
> echo $rank;
>
> if ($rank==1) {
> $atitle="A Summer Place";
> $cover="1960-001.jpg";
> };
>
> echo $atitle;
> echo "<img src='http://mroldies.net/covers/$cover'>";
>
> ?>
>
> I do not understand why $atitle is not being shown as it should be.
>
> This is just an experiment.

figured it out.
I've figured out another way of handling my massive data problem and it is
so simple it's pathetic.
No array needed.
The page has a very small footprint compared to one with a large array.
Re: echo outputs null why? [message #180708 is a reply to message #180649] Wed, 13 March 2013 14:11 Go to previous message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
On Thu, 07 Mar 2013 20:13:48 -0500, richard wrote:

> I do not understand why $atitle is not being shown as it should be.

Because $rank which is $_GET["rank"] is not ==1

--
Denis McMahon, denismfmcmahon(at)gmail(dot)com
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: In php applying the KISS rule wins every time
Next Topic: Re: Cloud Computing with PHP
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 01:24:42 GMT 2024

Total time taken to generate the page: 0.02490 seconds