Jump to content


getting echo data ?


  • Please log in to reply
5 replies to this topic

#1 Guest_t0rtilla_*

Guest_t0rtilla_*
  • Guests

Posted 25 June 2006 - 10:18 PM

<?php
if($_GET['id']=='0'){

        $a = '1234';

}
if($_GET['id']=='1'){

        echo $a;

}
?>

How can i get $a value from ?id=0 to ?id=1, but $a must be in ?id=0

#2 adamwhiles

adamwhiles
  • Members
  • PipPipPip
  • Advanced Member
  • 54 posts

Posted 25 June 2006 - 10:28 PM

not sure what your trying to do there, but maybe:
$_GET['id'] = $i;

if($i == 0) {

$a='1234';

$i++;
}

if($i== 1) {

echo $a;
}

try explaining a little better what you are wanting to do, not sure i understand fully.

#3 Guest_t0rtilla_*

Guest_t0rtilla_*
  • Guests

Posted 25 June 2006 - 10:51 PM

example wht im trying to do:
<?php
if($_GET['id']=='0'){

        $a = '1234.txt';

}
if($_GET['id']=='1'){

        echo '<a href="'. $a .'">'. $a .'</a>';

}
?>


#4 Unseeeen

Unseeeen
  • Members
  • PipPip
  • Member
  • 18 posts

Posted 25 June 2006 - 10:56 PM

Maybe try putting the
$a = '1234.txt';

before the first if?

I think this is what you're trying to do...if id == 1, then display a link with a in it.

#5 adamwhiles

adamwhiles
  • Members
  • PipPipPip
  • Advanced Member
  • 54 posts

Posted 25 June 2006 - 10:57 PM

the reason why you can't carry $a is because you are defining $a in a if statement so once you goto the other if statement you will lose $a because id can't equal both 0 and 1.

What is this script for? What are you trying to do with it?

#6 Guest_t0rtilla_*

Guest_t0rtilla_*
  • Guests

Posted 26 June 2006 - 12:54 AM

<?php

if($_GET['id']=='0')
{

        $a = '/test/truesalwo.png';
        $set = setcookie('img', $a);
        echo '<a href="?id=1" onClick="'. $set .'">show image</a>';

}
if($_GET['id']=='1')
{

        $a = $_COOKIE['img'];
        echo '<img src="'. $a .'">';

}

?>

solved my problem this way......... thnx evry1




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users