Guest t0rtilla Posted June 25, 2006 Share Posted June 25, 2006 [code]<?phpif($_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 Link to comment https://forums.phpfreaks.com/topic/12886-getting-echo-data/ Share on other sites More sharing options...
adamwhiles Posted June 25, 2006 Share Posted June 25, 2006 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. Link to comment https://forums.phpfreaks.com/topic/12886-getting-echo-data/#findComment-49472 Share on other sites More sharing options...
Guest t0rtilla Posted June 25, 2006 Share Posted June 25, 2006 example wht im trying to do:[code]<?phpif($_GET['id']=='0'){ $a = '1234.txt';}if($_GET['id']=='1'){ echo '<a href="'. $a .'">'. $a .'</a>';}?>[/code] Link to comment https://forums.phpfreaks.com/topic/12886-getting-echo-data/#findComment-49478 Share on other sites More sharing options...
Unseeeen Posted June 25, 2006 Share Posted June 25, 2006 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. Link to comment https://forums.phpfreaks.com/topic/12886-getting-echo-data/#findComment-49479 Share on other sites More sharing options...
adamwhiles Posted June 25, 2006 Share Posted June 25, 2006 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? Link to comment https://forums.phpfreaks.com/topic/12886-getting-echo-data/#findComment-49480 Share on other sites More sharing options...
Guest t0rtilla Posted June 26, 2006 Share Posted June 26, 2006 [code]<?phpif($_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 Link to comment https://forums.phpfreaks.com/topic/12886-getting-echo-data/#findComment-49503 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.