Results 1 to 2 of 2

Thread: PHP Photo Album script - Help with a variable in PHP?

  1. #1
    Join Date
    Mar 2008
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default PHP Photo Album script - Help with a variable in PHP?

    1) Script Title: PHP Photo Album script

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...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

    Code:
    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
    Code:
    title="'+galleryarray[i][0]+'"
    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?

  2. #2
    Join Date
    Jan 2007
    Posts
    629
    Thanks
    10
    Thanked 28 Times in 28 Posts

    Default

    Not sure that I understand what you're trying to do, but try changing this:
    Code:
    <? $name = '+galleryarray[i][0]+' ; ?>
    to something like:
    Code:
    <?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.
    --Jas
    function GreatMinds(){ return "Think Like Jas"; }
    I'm gone for a while, but in the meantime: Try using my FTP script | Fight Bot Form Submissions

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •