Jump to content

Archived

This topic is now archived and is closed to further replies.

Guest t0rtilla

getting echo data ?

Recommended Posts

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

        $a = '1234';

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

        echo $a;

}
?>[/code]

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

Share this post


Link to post
Share on other sites
not sure what your trying to do there, but maybe:
[code]
$_GET['id'] = $i;

if($i == 0) {

$a='1234';

$i++;
}

if($i== 1) {

echo $a;
}
[/code]

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

Share this post


Link to post
Share on other sites
Guest t0rtilla
example wht im trying to do:
[code]<?php
if($_GET['id']=='0'){

        $a = '1234.txt';

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

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

}
?>[/code]

Share this post


Link to post
Share on other sites
Maybe try putting the
[code] $a = '1234.txt';[/code]
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
Guest t0rtilla
[code]<?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 .'">';

}

?>[/code]

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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.