View Full Version : PHP Photo Album script - Help with a variable in PHP?

03-17-2008, 08:31 AM
1) Script Title: PHP Photo Album script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/php-photoalbum.htm

3) Describe problem:

Hey, I am trying to use a mix of php and this code, and i need to get the variable title out of this code into a php variable called name

function buildimage(i){
var imagecompletepath=(targetlinkdir!="")? targetlinkdir+galleryarray[i][0] : imagepath+galleryarray[i][0]
var tempcontainer='<a href="'+imagecompletepath+'" target="'+href_target+'" onClick="return popuplinkfunc(this)">'
tempcontainer+='<img src="'+imagepath+galleryarray[i][0]+'" title="'+galleryarray[i][0]+'"/>'
tempcontainer+='</a><br />'
tempcontainer+=(descriptionprefix[0]==1)? descriptionprefix[1]+(i+1) : ""
return tempcontainer

specifically looking at
I have already tried <? $name = '+galleryarray[i][0]+' ; ?> however as expected i just get the '+galleryarray[i][0]+' rather than the actual item...

any thoughts?

03-25-2008, 02:37 AM
Not sure that I understand what you're trying to do, but try changing this:

<? $name = '+galleryarray[i][0]+' ; ?>
to something like:

<?php $name = galleryarray[i][0]; ?>

But, if you're trying to go from javascript to php, that won't work. You would need to get the value using POST of GET methods or ajax or something else to pass the value to php.