AJAX variable in PHP

Hello,
$menuonfly .= 'var topLevel = new
Spry.Data.XMLDataSet("/menu/' . $params ['application'] .
'_menu.xml", "/buildmenu/toplevel");';
One of the node of the menu.xml file is called
<permissions>.
$menuonfly .= '<ul id="MenuBar1" class="MenuBarHorizontal"
spry:region="topLevel subLevel">';
$menuonfly .= '<li spry:repeat="topLevel">';
$permission_grant = ui_perm_check(LCKBX_VIEW,true,false);
I want to pass the value of the permission node into the
ui_perm_check function. How can i pass the spry ajax variable
called {permission} into php function. {permission} works very
nicely between two html tags.
thank you
kamal

I could be wrong here but I am not sure that you can pass it
back into a PHP variable because... the PHP gets executed before
the page gets sent to the browser... once the page is sent to the
browser that JS runs locally on the client machine and since the
PHP has already rendered it isn't possible to pass a variable back.
You will have to post it back to the server rerun the PHP and
then pass the page back.

Similar Messages

  • Is it possible to load and send variables to php at the same time?

    Hello, with this line:
    request.method = URLRequestMethod.GET; you can receive
    variables from php.
    and with request.method = URLRequestMethod.POST you can send
    variables.
    But is it possible to do this simultaniously ?

    they both send and receive data sequentially. ie, data is
    sent (if there is any) and then data is received (if there is
    any).

  • How to Trace Variables in PHP ?

    Hi - Does any ome know an easy wasy of tracing variable in PHP ideally through DW ? for example, I might have $Main which has been reset 3 times across 3 page / functions - I want to follow that variable 'upstream' to it's root for degugging purposes.
    Any Ideas ?
    thansk Vincej

    I use the comments option.
    Alex
    (link removed by moderator)

  • Captivate score variables to PHP

    Since most Captivate files are published as SWF, I was
    wondering if some one hear has Captured the scores variables in PHP
    or another method.
    I was wondering how the score and question tracking variables
    where named in Captivate. I am trying tpo capture them with the
    POST methods and then save the scores in a MySQL database. I can do
    it with Flash because I know what the variables are named, but I am
    not sure how Captivate names the variables.

    Since most Captivate files are published as SWF, I was
    wondering if some one hear has Captured the scores variables in PHP
    or another method.
    I was wondering how the score and question tracking variables
    where named in Captivate. I am trying tpo capture them with the
    POST methods and then save the scores in a MySQL database. I can do
    it with Flash because I know what the variables are named, but I am
    not sure how Captivate names the variables.

  • CF variable to PHP script

    Situation:
    My main site is coded in CF. My forum is coded in php. I am
    in the process of creating a single uniform log in and don't want
    to pass the log in information retrieved by CF via URL. I know
    passing by session is out the picture, and I'm not trying to repost
    by form, so I was thinking about using a cookie to store the
    infomation and then destroying it after log in.
    Question:
    What is the safest way to pass a cf variable to php?

    All the data is on the same database, just that one set of
    tables I created myself and the other set was created dynamically
    by the forum's set up script.
    So far I pull the members info for log in on the primary site
    (via email & password). In doing so, I pull the members
    username (not id as previously mentioned), and now need to use the
    stored username and password to log into the forum.
    Just saw your responce Dan, I'll give that a try. Thanks. And
    you too Mike.

  • How to pass spry {} variables to PHP query sentence?

    I am trying to integrate AJAX poll system to a spry data set.
    My goal is to dynamically generate a poll fom associated with the id no. of each data item.
    So, I need to pass a spry xml variable covered by { } to a PHP query sentence.
    How? Is there any existing Spry poll solution? Thanks.

    The following sentence has been inserted into my code, but it doesn't work:
    <span spry:if="'ds_RowCount' == '0'">No Data to Display</span>
    ====
    <div spry:region="ds1" class="SpotlightAndStacked">
      <div spry:repeat="ds1" class="SpotlightAndStackedRow">
        <div class="SpotlightContainer">
          <div class="SpotlightColumn"> Type:{type}</div>
          <div class="SpotlightColumn"> Title:{title}</div>
          <div class="SpotlightColumn"> Username:{username}</div>
        </div>
        <div class="StackedContainer">
          <div class="StackedColumn"> <img src="upPhoto/{image}" width="144" height="144"/></div>
        </div>
        <br style="clear:both; line-height: 0px" />
      </div>
    <span spry:if="'ds_RowCount' == '0'">No Data to Display</span>
    </div>
    ====

  • Flash Builder 4.5 for PHP - show variable from PHP in app

    I have searched for hours and I can't figure this out…
    Is there a way to somehow "echo" my PHP code in my MXML file ?
    I know you can't echo something from PHP to MXML, so here's what I have done :
    I get my informations from my database, I need to show an image and its title, so I put the following code in a variable :
    <mx:Image id="laniraBlanche" x="25" y="65" width="210" height="126" source="'.$row->image_mini.'" click="selectLaniraBlanche()" rollOver="seePicture()" rollOut="outPicture()" />                                              <s:Label x="25" y="155.85" text="'.$row->nom.'" width="210" textAlign="center" height="37" fontSize="19" backgroundColor="#676666" verticalAlign="middle" fontFamily="Georgia" color="#FFFFFF" click="selectLaniraBlanche()" rollOver="seePicture()"  id="laniraBlancheTxt" rollOut="outPicture()" />'
    Then, I return that variable.
    I find the function where my var created is returned from the "Data/Service" tab, I am on Design mode on Flash Builder, and I "drop" my function where I want my image and text to show on my app.
    I tryed dropping it in a "group", it doesn't show anything. I tryed several other options, and nothing worked.
    So my question is, how could I have this code created in PHP show on my application ?
    Thank you  for your help

    I also have Flash Builder 4.5 for PHP and the ANT view does not show when going to Window -> Show View --> Other.  I could not find it in any of the folders.
    However, I was able to add it by hitting Command 3 (CTRL 3 on PC) and typing Ant.

  • Passing variable from php into flash, help please

    Here are what I'm having:
    <?PHP
    $testVal = "This is a test";
    $test = urlencode($testVal);
    $out = "test=". $testVal;
    echo $out;
    ?>
    // and this is my flash file
    function getData() {
    // Prepare request
    var urlReq:URLRequest=new URLRequest("http://localhost/test.php");
    urlReq.method=URLRequestMethod.GET;
    var loader:URLLoader = new URLLoader();
    loader.dataFormat=URLLoaderDataFormat.VARIABLES;
    loader.addEventListener(Event.COMPLETE, completeHandler);
    loader.load(urlReq);
    function completeHandler(evt:Event) {
    var vars:URLVariables = URLVariables(evt.target.data);
    trace(" TEST = ", vars.test);
    trace(" TEST = ", unescape(vars.toString()));
    // and below is the ouput
    TEST = undefined
    TEST = test=This is a test
    I've tried with several different ways to get ONLY the value of the variable - that means I only want to have "This is a test" returned, but I either got "undefined" or the whole thing "test=This is a test", instead.
    I'm new to Flash and PHP. Please help.
    Thanks

    There's no need to write any fake variables out, Flash does not need that. OK, here's a simple PHP script like yours - I called it test.php
    <?PHP
         $testVal = "This is a test";
         $out = "test=". $testVal;
         echo $out;
    ?>
    And the AS to call it:
    var myLoader:URLLoader = new URLLoader();
    myLoader.dataFormat = URLLoaderDataFormat.VARIABLES;
    myLoader.load(new URLRequest("http://www.mydomain.com/test.php"));
    myLoader.addEventListener(Event.COMPLETE, dataLoaded, false, 0, true);
    function dataLoaded(e:Event){  
        trace( e.target.data.test);
    You will see 'This is a test' traced to the output window.
    HTH

  • Cannot pass variables from PHP to actionscript 3.0

    I am using CS3 and I write the following code as to pass variable to flash from PHP
    Actionscript
    var myLoader:URLLoader = new URLLoader();
    myLoader.dataFormat = URLLoaderDataFormat.TEXT;
    var myRequest:URLRequest=new URLRequest("http://localhost/moodle/value.php");
    myLoader.load(myRequest);
    myLoader.addEventListener(Event.COMPLETE,onCompleteHandler);
    var myValue: String;
    function onCompleteHandler(e:Event):void{
              var myvariable: URLVariables = new URLVariables(e.target.data);
              myValue = myvariable.values;
                      trace(myValue);
    PHP file
    <?php
       echo ('values = 8');
    ?>
    But I always get the error and cannot get the values by using trace();
    Before i try to use "myLoader.dataFormat = URLLoaderDataFormat.VARIABLES;" I still get the same error.
    Error: Error #2101: The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs
              at Error$/throwError()
              at flash.net::URLVariables/decode()
              at flash.net::URLVariables$iinit()
              at flash.net::URLLoader/flash.net:URLLoader::onComplete()
    Can anyone help me?

    The error is fixed.The new version is like that
    Actionscript
    var myLoader:URLLoader = new URLLoader();
    myLoader.dataFormat = URLLoaderDataFormat.TEXT;
    var myRequest:URLRequest=new URLRequest("http://localhost/moodle/value.php");
    myLoader.load(myRequest);
    myLoader.addEventListener(Event.COMPLETE,onCompleteHandler);
    var myValue: String;
    function onCompleteHandler(e:Event):void{
              var myvariable: URLVariables = new URLVariables(e.target.data);
              myValue = myvariable.values;
                      trace(myValue);
    php file
    <?php
       echo "values=8";
    ?>
    The output finally is "null" in flash file. Why does it happen? It should give me 8 when I input trace(myValue);

  • Oracle text & xpath / binding variables in php

    Hello,
    I am using Oracle 10g XE.
    Here is the php code for which I have a problem :
    $stmt=oci_parse($con, "SELECT NRSS FROM XNRSS WHERE CONTAINS(NRSS, '(HASPATH(/nrss/channel/item/identifier[@assetId=:ASSETID]))')>0");
    oci_bind_by_name($stmt, ":ASSETID", $i)) echo "erreur";
    This code does not work and I think the reason is that I don't use correctly the variable :ASSETID inside the xpath '(HASPATH(/nrss/channel/item/identifier[@assetId=:ASSETID]))'
    How should I use the variable ?
    Thanks for your help
    Eve

    HASPATH and INPATH are not part of XML DB. They offer XPATH like search capabilities based on text indexes.
    The XDB way would be
    existsNode(NRSS, '/nrss/channel/item/identifier[@assetId=' || :ASSETID || '])')>0";

  • SESSION VARIABLE in PHP

    I am new to web applications, but for what I need is to know
    how to use session variables. When a user logins I want thier
    information stored so when they visit my account they are able to
    see thier information and not someone elses. Any help should be in
    PHP format. Thank you in advance.

    prashi123 wrote:
    > I am new to web applications, but for what I need is to
    know how to use session
    > variables. When a user logins I want thier information
    stored so when they
    > visit my account they are able to see thier information
    and not someone elses.
    > Any help should be in PHP format. Thank you in advance.
    http://www.php.net/manual/en/features.sessions.php
    David Powers
    Adobe Community Expert
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    http://foundationphp.com/

  • How to generate a random session variable in php

    i want to generate a random session variable and insert the variable in a mysql record to use later to validate an account set up.
    person fills out form to create account and submits; inserts form information in mysql record.
    i want the random variable to be inserted from a hidden field and the page sends an email with a link to click on to compare the variable to validate the user.
    Not sure how to generate a random session variable and get that to the hidden field value to be inserted with the other form information.
    thanks for your help,
    Jim Balthrop

    To insert the key I would personally do something like...
    $key = md5($username . $password . $salt);
    Insert that into your MySQL database, then send them a email with it, my next code shows how to activate it.
    This is to activate the account.
    <?php
    $key;
    $errors = array();
    if(isset($_GET['key']){
         $key = $_GET['key'];
         $sql = 'SELECT * FROM users WHERE key = \'' . $key '\' LIMIT 1';
         $result = mysql_query($sql) or die(mysql_error());
         if(mysql_num_rows($result)){
              $sql2 = 'UPDATE users SET active = 1 WHERE key = \'' . $key '\' LIMIT 1';
              $result2 = mysql_query($sql2) or die(mysql_error());
              if($result2){
                   //successfully activated account
              else{
                   //Something Went Wrong!
         else{
              $errors[] = 'Invaild Key, Please try again!';
    else{
         $errors[] = 'Invaild Key, Please try again!';
    ?>

  • Creating a session variable with PHP

    Can anyone offer me a PHP script that creates a session
    variable? The Dreamweaver CS3 Help documentation offers coding
    samples for ColdFusion and ASP but not for PHP. I tried this
    without success:
    "$_SESSION['usermail']= $_POST['sub_email'];" in which I am
    trying to capture an email address from a form and save it to use
    in a confirmation email to a new subscriber. Any help would be
    sincerely appreciated.
    [email protected]

    I use this -
    <?php
    if (!isset($_SESSION)) {
    session_start();
    ?>
    at the top of the page, and then this within the code block
    where you are
    processing the form's data -
    $_SESSION['usermail']= $_POST['sub_email'];
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "Jugdish" <[email protected]> wrote in
    message
    news:gb8aov$691$[email protected]..
    > Can anyone offer me a PHP script that creates a session
    variable? The
    > Dreamweaver CS3 Help documentation offers coding samples
    for ColdFusion
    > and ASP
    > but not for PHP. I tried this without success:
    > "$_SESSION['usermail']= $_POST['sub_email'];" in which I
    am trying to
    > capture
    > an email address from a form and save it to use in a
    confirmation email to
    > a
    > new subscriber. Any help would be sincerely appreciated.
    > [email protected]
    >

  • Strange Error when pass variable to PHP

    I am passing the following variable from java to a php variable but I am getting an extra character. For example:
    char c= ' " ';
    String s1 = "Hello World";
    String s2 = c+s1+c;When I pass s2 to a php varibale using URLEncoder.encode(s2) php prints out /"Hello World/" instead of "Hello World". Any idea why is that happening? I am using jdk 1.1 for Virtual Machine compatability reasons so the URLEncoder.encode get only one parameter .

    Hello.
    This could very well be a PHP related matter. Could you PLEASE include some of the PHP code that interact with this java code? It is pretty hard to guess how that goes.
    If the PHP code were to contain backward slashes, like \"Hello world\" then the string might be just slash quoted. Printing out the string using (PHP code) stripslashes() will remove them.
    .

  • Accessing session variables with php

    I am trying to access the  session variable  $_SESSION['MM_Username']  in one of my php pages, but it is somehow showing empty (i.e it does not contain the username that was entered during login).
    I checked and confirmed that my login.php function is properly setting the MM_Username session variable by echoing it  from the login function.
    So why can't I read it from another php file in the same session?  Do I need to do something else before the session variables can
    be properly read from any php file in the same session?  Any help would be appreciated.

    Here is a test code I am using to access the session variable $_SESSION['MM_username']  from  the php page  test.php. But it is not working.
    I get an empty string all the time for $username. Can any one see something wrong with this code?
    <?php require_once('Connections/MyTestingConn.php'); ?>
    <?php session_start(); ?>
    <?php
    $username = "-1";
    if (isset($_SESSION['MM_username'])) {
      $username = $_SESSION['MM_username'];
      echo $username;
    else
       echo "Eror: can not access session variable";
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Test</title>
    </head>
    <body>
    </body>
    </html>

Maybe you are looking for