need some help with passing a variable to slideshow

Discussion in 'PHP' started by dougvcd, Sep 2, 2008.

  1. #1
    ok i have a page which displays a list with some info
    on each record there is a more info line when pressed takes you to another page and displays all the info to that record i have put a slide show on that page so i need to pass a variable to show the right folder with pics in
    i have a variable at the moment which shows 1 pic which is pname i was going to use that if possable
    here is some of the first page code

    //Puts it into an array 
    while($info = mysql_fetch_array( $data )) 
    { 
    //Outputs the image and other data
    Echo "<img src=http://www.djbcaravanhire.co.uk/images2/".$info['pname'] ." alt=\"Image\" align=\"left\" width=\"150px\" height=\"100px\" hspace=\"10px\" vspace=\"8px\"> <br>";
    Echo "<b>Available for:</b><font color=blue> ".$info['region'] . "</font><br>";
    Echo "<b>County:</b> ".$info['county'] . " <br>";
    Echo "<b>Park Name:</b> ".$info['parkname'] . " <br>";
    Echo "<b>Park Location:</b> ".$info['parklocation'] . " <br>";
    Echo "<b>Make & Model:</b> ".$info['make'] . " <br>";
    if(empty($info[web]))
    {
    $web = "Not Provided" ;  }
    else {
    $web = "<a href=$info[web]>More Info</a> "; }
    
    Echo "<b>Information:  </b><a href=display.php?id=".$info['username'].">More Info</a><hr>";
    } 
    
    ?>  
    PHP:
    and this is the display page as i have it at the moment

    <script language=javascript>
    var width = 250;
    var height = 100;
    var imgAr1 = new Array();
    var rImg1 = new Array();
    
    imgAr1[0] = "http://www.djbcaravanhire.co.uk/show/grandma7943/1.jpg";
    imgAr1[1] = "http://www.djbcaravanhire.co.uk/show/grandma7943/2.jpg";
    imgAr1[2] = "http://www.djbcaravanhire.co.uk/show/grandma7943/3.jpg";
    imgAr1[3] = "http://www.djbcaravanhire.co.uk/show/grandma7943/4.jpg";
    </script>
    
    <table cellpadding=0 cellspacing=0 align="center" style="position: absolute; width: 165px; height: 62px; left: 519px; top: 231px" id="slide">
      <tr><td style="border: 2px ridge red;">
    <img id=pic border=0>
    </td></tr>
    <tr><td>
    <table width=100% style="border: 2px ridge red; font-size: 13px; font-family: verdana, arial;"> 
    <td align=center><a style="color: blue; cursor:pointer;" onclick="slideshow()">Next</a></td> 
    <td align=center><a style="color: blue; cursor:pointer;" onclick="prev()">Prev</a></td> 
    <td align=center><a href="http://www.hscripts.com" style="color: blue; text-decoration: none; 
    cursor:ponter; font-size: 13px;">&copy;H</a></td> 
    </tr></table>
    </td></tr></table>
    </form>
    
    <script language=javascript>
    
    for(var j = 0; j < imgAr1.length; j++)
    {
    		rImg1[j] = new Image();
                rImg1[j].src = imgAr1[j];
    }
    
    document.onload = setting();
    
    var slide;
    function setting()
    {
    	slide = document.getElementById('pic');
    	slide.src = imgAr1[0];
    	slide.setAttribute("200",width);
    	slide.setAttribute("150",height);
    }
    
    //Image or picture slide show using java script
    //slideshow function
    var picture = 0;
    function slideshow(){
    	if(picture < imgAr1.length-1){
    		picture=picture+1;
    		slide.src = imgAr1[picture];
    	}
    }
    
    function prev(){
    	if(picture > 0 ){
    		picture=picture-1;
    		slide.src = imgAr1[picture];
    	}
    }
    
    function start(){
    		slide.src = imgAr1[0];
    		picture = 0;
    }
    
    function end(){
    		slide.src = imgAr1[imgAr1.length-1];
    		picture = imgAr1.length-1
    }
    </script>
    <!-- Script by hscripts.com -->
    <p/>
    
    	<div id="display" style="position: absolute; width: 982px; height: 100px; z-index: 1; left: 53px; top: 451px">
    	<?php
    
    $id = $_GET["id"];
    // Connects to your Database 
     $dbh=mysql_connect("localhost", "vcd", "57") or die('I cannot connect to database because: ' .mysql_error()) ; 
    mysql_select_db("sers"); 
     
    //Retrieves data from MySQL
      $data = mysql_query("SELECT * FROM members WHERE username='$id'") or die(mysql_error());
    
    //Puts it into an array 
    while($info = mysql_fetch_array( $data )) 
    { 
    $count = $info['enq'] ;
    //Outputs the image and other data
    Echo "<b>Available for:</b> ".$info['region'] . "<br>";
    Echo "<b>Name:</b> ".$info['name'] . " <br>";
    Echo "<b>Contact:</b> ".$info['contact'] . " <br>";
    Echo "<b>Park Name:</b> ".$info['parkname'] . " <br>";
    Echo "<b>County:</b> ".$info['county'] . " <br>";
    Echo "<b>Park Location:</b> ".$info['parklocation'] . " <br>";
    Echo "<b>Details:</b> ".$info['caravandetails'] . " <br>";
    Echo "<b>Smoking:</b> ".$info['smoke'] . " <br>";
    Echo "<b>Pets:</b> ".$info['pets'] . " <br>";
    Echo "<b>Children:</b> ".$info['kids'] . " <br>";
    Echo "<b>Same sex groups:</b> ".$info['sex'] . " <br>";
    }
    
    ?>  
    
    </div>
    PHP:
    http://www.djbcaravanhire.co.uk/show/grandma7943/
    1.jpg
    can i change the grandma7943 to .$info['pname']
    cheers
    Doug
     
    dougvcd, Sep 2, 2008 IP
  2. Xabber

    Xabber Active Member

    Messages:
    437
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #2
    I guess you should read something about .htaccess :)
     
    Xabber, Sep 2, 2008 IP
  3. dougvcd

    dougvcd Peon

    Messages:
    267
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks but that dosnt help me much
    cheers
    Doug
     
    dougvcd, Sep 2, 2008 IP
  4. dougvcd

    dougvcd Peon

    Messages:
    267
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    ok all sorted now
    Doug
     
    dougvcd, Sep 2, 2008 IP