Passing variable to php

Discussion in 'PHP' started by doop, Sep 14, 2009.

  1. #1
    I'm using the xml/swf graphs from http://www.maani.us/xml_charts/ and am using php to create an xml file for the graphs output.

    Here's my problem:

    I need to pass a value into the php file being called ( $result) so when it forms the xml it will insert this value into the graph for a label.

    How can I do this?!

    Here is the PHP:

    <?php
    print "<chart>";
    print "<chart_type>area</chart_type>";
    print "<chart_data>";
    print " <row>";

    print "<number note='You Got " . $result . "' Correct'>". $result . "</number>";

    /// more stuff in between goes here....

    print " </row>";
    print "</chart_data>";
    print "</chart>";

    ?>


    And this is the javascript that calls the php
    -----

    <script language="JavaScript" type="text/javascript">
    <!--
    if (AC_FL_RunContent == 0 || DetectFlashVer == 0) {
    alert("This page requires AC_RunActiveContent.js.");
    } else {
    var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
    if(hasRightVersion) {
    AC_FL_RunContent(
    'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,45,0',
    'width', '600',
    'height', '250',
    'scale', 'noscale',
    'salign', 'LT',
    'bgcolor', '#fff',
    'wmode', 'opaque',
    'movie', 'charts',
    'src', 'charts',
    'FlashVars', 'library_path=charts_library&xml_source=getchart.php',
    'id', 'my_chart',
    'name', 'my_chart',
    'menu', 'true',
    'allowFullScreen', 'true',
    'allowScriptAccess','sameDomain',
    'quality', 'high',
    'align', 'middle',
    'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
    'play', 'true',
    'devicefont', 'false'
    );
    } else {
    var alternateContent = 'This content requires the Adobe Flash Player. '
    + '<u><a href=http://www.macromedia.com/go/getflash/>Get Flash</a></u>.';
    document.write(alternateContent);
    }
    }
     
    doop, Sep 14, 2009 IP
  2. stephan2307

    stephan2307 Well-Known Member

    Messages:
    1,277
    Likes Received:
    33
    Best Answers:
    7
    Trophy Points:
    150
    #2
    Try something like this

    
    
    'FlashVars', 'library_path=charts_library&xml_source=getchart.php?result=<?php echo $result;?>', 
    
    
    PHP:
    Then in the other file simply do it this way


    
    
    print "<number note='You Got " . $_GET['result'] . "' Correct'>". $_GET['result'] . "</number>";
    
    
    PHP:
     
    stephan2307, Sep 14, 2009 IP
  3. pneulameiro

    pneulameiro Peon

    Messages:
    440
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    just put a variable in the session and get this same variable in the php script.
     
    pneulameiro, Sep 14, 2009 IP