Where pictures is the field for the larger image the thumbnail is what it says. The popup window code is below. Would appreciate if you can help me figure out what is no longer allowed. It used to work just fine.
Presuming that the second section of code is your show_image.php, is the code to extract $img from the URL somewhere else, and is it working correctly?
I’ve a vague idea that someone mentioned that very early versions of PHP would automatically parse URL variables into internal variables of the same name, but I can’t find a reference to it, I’d always expect to see it extracted from the appropriate superglobal array, $_GET in this case.
Yes, but not in the completely separate show_image.php script, where you are trying to use it. You’re passing the value of that variable through in the URL, but not the name of it. In this section of code:
you are assigning it a value immediately after you echo the value as part of the URL, but only within this specific script. In fact if this is a catalogue of images, perhaps this bit of code is inside a loop, which means that the value of $img is changed for each iteration of the loop.
That’s not the correct syntax. Have a look at the post above. In order for that line to work, you first have to have a value in $img. As you said that’s the first line of the script, there can’t be any lines before it to have assigned $img any kind of value, so that equates to $_GET[''], which might give an undefined index error.
I appreciate the help. The frustrating thing is that it used to work just fine. So I’m not sure what I need to add to get the variable to pass through. It is in a loop of catalog images, so it has to post the current image value on click. However, if I place the GET after the first line, the $img variable is already assumed, which is no longer working. It isn’t being passed.
What do you suggest? The other thing I thought of might be a complete php hover solution, if that is possible. But couldn’t find an example that would eliminate the need for a pop up. But if it relies on scripts, I might have the same issue.
As in my earlier post, you need to get the value from the URL:
<?php $id1 = basename($_GET['img'], '.gif');
I did mention that I’ve a vague idea that (very) old versions of PHP didn’t need this, that they would automatically parse out parameters into variables. I tried a bit of a search to see if I’d imagined it, but I didn’t get very far. That would certainly explain why it used to work, though.
OK. Can you modify the start of your show_image.php file to read like this, then show the results when you click on the link please?
Or, if you haven’t changed the use of $img further down the page to use the $_GET array member, you could just add this line:
$img = $_GET['img']; // this is the new line
$id1 = basename($img, '.gif'); // and this is your old first line, carry on from here
but I doubt that would help, as all the other data (title, description) would have been populated after you changed the start of the script as per post 12. As you said that hadn’t worked, I presumed the title and so on was still blank at that point.