SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist
    Join Date
    Mar 2008
    Posts
    551
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How can I put flashvars into a php session?

    How can I put flashvars into a php session? Thank you very much.
    I set up a session in php in my page:
    PHP Code:
    <?php 

    // this starts the session  

    session_start(); 

    // this sets variables in the session  

    $_SESSION['test']='testing';  

    print 
    "Done"

    ?>
    Now I have flashvars that I want to put into the session:


    PHP Code:
    <script type="text/javascript">
                var flashvars = {autoclass:"<?php echo($_GET['autoclass']); ?>",
                cilinder:<?php echo($_GET['cilinder']); ?>, year:"<?php echo($_GET['year']); ?>", currentDate:"<?php echo date("Y-m-d"); ?>"};
            
                    
            var attributes = {};
                
                
                var params = {
                  allowfullscreen: "true"
                  
                };
                swfobject.embedSWF("/flash/myflashfile.swf", "myContent", "950", "580", "9.0.0.0","expressInstall.swf", flashvars, params, attributes);
            </script>

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    session_start();
    if (isset(
    $_GET['autoclass']))
        
    $_SESSION['autoclass'] = $_GET['autoclass']; 
    and on the webpage

    PHP Code:
    var flashvars = {autoclass:"<?php echo $_SESSION['autoclass']; ?>",
    Like that?

  3. #3
    SitePoint Evangelist
    Join Date
    Mar 2008
    Posts
    551
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Dan that seems to be putting the values into a session nicely. Now I can just output them as needs be. Is there anyway I can create php session variables in flash?
    <?php // this starts the session session_start(); // this sets variables in the session $_SESSION['test']='testing'; if (isset($_GET['autoclass'])) $_SESSION['autoclass'] = $_GET['autoclass']; if (isset($_GET['cilinder'])) $_SESSION['cilinder'] = $_GET['cilinder']; if (isset($_GET['year'])) $_SESSION['year'] = $_GET['year']; ?>
    I think I have found how to do it "A way Flash can send information to an external PHP page is through the loadVariables Actionscript command."

    Thanks


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
  •