SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Addict
    Join Date
    Jun 2007
    Location
    Plymouth uk
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question need help making a variable

    ok i have this bit of code
    PHP Code:
    Echo   "<b>Information:  </b><a href=display.php?id=".$info['username']."id=".$info['slide'].">More Info</a><hr>"
    how can i make slide a variable that i can take to another page
    to use in the code below
    PHP Code:
    imgAr1[0] = "http://www.djbcaravanhire.co.uk/show/slide/1.jpg"
    cheers
    Doug
    an old man of 60 trying to keep up with the youngsters he he
    http://lostpetsplymouth.net16.net

  2. #2
    Coding and Breathing CoderMaya's Avatar
    Join Date
    Feb 2008
    Location
    Atlit, Israel
    Posts
    470
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could send it in a session.
    In the start of your code, add session_start();
    Then do $_SESSION['theImage'] = $imgAr1[0];
    Then in the next page, you could access that variable - $_SESSION['theImage'].
    Learn about the new Retro Framework
    Code PHP the way it was meant to be coded!

  3. #3
    SitePoint Addict
    Join Date
    Jun 2007
    Location
    Plymouth uk
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for reply not sure if that will do what i want but will give it a try
    cant i do any thing like
    $var_slide = .$info['slide']
    cheers
    Doug
    an old man of 60 trying to keep up with the youngsters he he
    http://lostpetsplymouth.net16.net

  4. #4
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,806
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    Very close Doug, just need the & to separate the arguments and watch for the quotes.

    The link
    PHP Code:
    echo   '<b>Information:  </b><a href="display.php?id='.$info['username'].'&slide='.$info['slide'].'">More Info</a><hr>'
    PHP Code:
    $imgAr1[0] = $_GET['slide']; 
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  5. #5
    SitePoint Addict
    Join Date
    Jun 2007
    Location
    Plymouth uk
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks buddy
    this is what i have

    <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/$_GET['slide']/1.jpg";
    imgAr1[1] = "http://www.djbcaravanhire.co.uk/show/pics11/2.jpg";
    imgAr1[2] = "http://www.djbcaravanhire.co.uk/show/pics11/3.jpg";
    imgAr1[3] = "http://www.djbcaravanhire.co.uk/show/pics11/4.jpg";
    </script>
    cheers
    Doug
    an old man of 60 trying to keep up with the youngsters he he
    http://lostpetsplymouth.net16.net

  6. #6
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,806
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    ah right, so its a javascript array rather than a PHP array

    PHP Code:
    echo '
        <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/'
    $_GET['slide'] .'/1.jpg";
            imgAr1[1] = "http://www.djbcaravanhire.co.uk/show/pics11/2.jpg";
            imgAr1[2] = "http://www.djbcaravanhire.co.uk/show/pics11/3.jpg";
            imgAr1[3] = "http://www.djbcaravanhire.co.uk/show/pics11/4.jpg";
        </script>
    '

    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  7. #7
    SitePoint Addict
    Join Date
    Jun 2007
    Location
    Plymouth uk
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    big thank you again
    got it working in the end
    must get my eyes tested next
    he he he
    cheers
    Doug
    an old man of 60 trying to keep up with the youngsters he he
    http://lostpetsplymouth.net16.net


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
  •