Current location: Hot Scripts Forums » Programming Languages » PHP » $ problem...


$ problem...

Reply
  #1 (permalink)  
Old 07-20-06, 02:13 AM
jonnekke jonnekke is offline
Code Guru
 
Join Date: Oct 2005
Location: holland!
Posts: 706
Thanks: 0
Thanked 0 Times in 0 Posts
$ problem...

Hi there..

in my php file this link is placed:

PHP Code:

echo "<a href=\"javascript:pop4('big.php?pic=$picture')\"><img src='pics/$data[$c]' width='50'></a>"
and this script to open a pop-up:

PHP Code:

echo " <SCRIPT LANGUAGE=\"JavaScript\">

 var link
link = 'big.php?pic=
$picture';

function pop4(locatie, hoogte12, breedte18) {
var breedte12 = 1024
var hoogte14 = 735
var winl = (screen.width-breedte12)/2;
var wint = (screen.height-hoogte14)/2;
var wint2 = screen.height-hoogte14;
window.open(link, \"\", \"height=400 , width=400 , top=50, left=50 ,scrollbars=auto, toolbar=0, resize=no\");
}
</SCRIPT> "

the link in my php page looks like this:

Code:
javascript:pop4('big.php?pic=image_441e956f0316b.gif')
unfortunatly $pic is empty in the file big.php.

The php in big .php looks like:

PHP Code:

<?

extract 
($_GET);

echo 
'<img src="pics/$pic]">';?>

where did it go wrong?......

Last edited by jonnekke; 07-20-06 at 02:16 AM.
Reply With Quote
  #2 (permalink)  
Old 07-20-06, 02:49 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
Quote:
Originally Posted by jonnekke
PHP Code:

<?

extract 
($_GET);

echo 
'<img src="pics/$pic]">';?>
The variable is between single quotes, it won't be parsed. Plus, I'd use $_GET['pic'] instead of using extract().

PHP Code:



echo "<img src=\"pics/"$_GET['pic'] ."\">"
Reply With Quote
  #3 (permalink)  
Old 07-20-06, 02:54 AM
jonnekke jonnekke is offline
Code Guru
 
Join Date: Oct 2005
Location: holland!
Posts: 706
Thanks: 0
Thanked 0 Times in 0 Posts
that's wierd,

in another file on the same server (other folder)..

i use

PHP Code:

echo "<img src='fotos/$_GET[image]'> "
and that's working perfect...
Reply With Quote
  #4 (permalink)  
Old 07-20-06, 02:59 AM
jonnekke jonnekke is offline
Code Guru
 
Join Date: Oct 2005
Location: holland!
Posts: 706
Thanks: 0
Thanked 0 Times in 0 Posts
I tried you're solution...

but it's still nog working..

Reply With Quote
  #5 (permalink)  
Old 07-20-06, 03:41 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
Look at the source code of big.php when you expect to see the image. What do you see there?
Reply With Quote
  #6 (permalink)  
Old 07-20-06, 03:46 AM
jonnekke jonnekke is offline
Code Guru
 
Join Date: Oct 2005
Location: holland!
Posts: 706
Thanks: 0
Thanked 0 Times in 0 Posts
this is the source of big.php:

PHP Code:

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>Vloer</title>
</head>
<style type="text/css">
a:link {font-family: Verdana, Arial, Helvetica; font-size: 11px; color: #2A3B45; text-decoration: none;}
a:visited {font-family: Verdana, Arial, Helvetica; font-size: 11px; color: #2A3B45; text-decoration: none;}
a:hover {font-family: Verdana, Arial, Helvetica; font-size: 11px; color: #2A3B45; text-decoration: underline;}
a:active {font-family: Verdana, Arial, Helvetica; font-size: 11px; color: #2A3B45; text-decoration: none;}
</style>
</head>
<body topmargin="20" leftmargin="20">
<table><tr><td width="350" height="350" align="center" valign="middle">
<?
 
echo "<img src=\"pics/"$_GET[picture] . "\">"


?>
</td></tr></table>
</body> 
</html>
Reply With Quote
  #7 (permalink)  
Old 07-20-06, 03:48 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
I mean when you see the page in your browser. Do rigth click in the window and hit "view page source".
Reply With Quote
  #8 (permalink)  
Old 07-20-06, 03:52 AM
jonnekke jonnekke is offline
Code Guru
 
Join Date: Oct 2005
Location: holland!
Posts: 706
Thanks: 0
Thanked 0 Times in 0 Posts
excuse me.. :s

PHP Code:

<html>

<
head>
<
meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<
title>Vloer</title>
</
head>
<
style type="text/css">
a:link {font-familyVerdanaArialHelveticafont-size11pxcolor#2A3B45; text-decoration: none;}
a:visited {font-familyVerdanaArialHelveticafont-size11pxcolor#2A3B45; text-decoration: none;}
a:hover {font-familyVerdanaArialHelveticafont-size11pxcolor#2A3B45; text-decoration: underline;}
a:active {font-familyVerdanaArialHelveticafont-size11pxcolor#2A3B45; text-decoration: none;}
</style>
</
head>
<
body topmargin="20" leftmargin="20">
<
table><tr><td width="350" height="350" align="center" valign="middle">
<
img src="pics/"></td></tr></table>
</
body
</
html
Reply With Quote
  #9 (permalink)  
Old 07-20-06, 03:58 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
Ah,.. if your link looks like this
Code:
javascript:pop4('big.php?pic=image_441e956f0316b.g  if')
big.php expects to get a variable called "pic", not "picture". Try this.

PHP Code:

echo "<img src=\"pics/"$_GET['pic'] . "\">"
Reply With Quote
  #10 (permalink)  
Old 07-20-06, 04:02 AM
jonnekke jonnekke is offline
Code Guru
 
Join Date: Oct 2005
Location: holland!
Posts: 706
Thanks: 0
Thanked 0 Times in 0 Posts
my link looks like this:

PHP Code:

<a href=\"javascript:pop4('big.php?pic=$picture')\"><img src='pics/$data[$c]' width='50'></a> 

and this is where is supposed to show the picture..

PHP Code:

<?

 
echo "<img src=\"pics/"$_GET[pic] . "\">"
?>
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
bulk folder problem AimHigh PHP 2 06-09-06 03:06 AM
Weird mysql_query and Smarty problem Canglan PHP 3 11-15-05 08:49 PM
Download problem lcwei81 PHP 4 09-26-05 01:28 AM
Count problem kasic ASP.NET 1 10-20-04 12:23 AM
Asp and Microsoft Access 2002 problem gop373 ASP 2 10-06-04 09:13 AM


All times are GMT -5. The time now is 07:22 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.