Home     |     Java    |     Php General    |     Oracle Database    |     Oracle Server  

MS Dynamics CRM 3.0

  •  Setting up and Configuring Microsoft Dynamics CRM 3.0
  •  Managing Security and Information Access
  •  Entity Customization: Concepts and Attributes
  •  Entity Customization: Forms and Views
  •  Entity Customization: Relationships, Custom Entities, and Site Map
  •  Reporting and Analysis
  •  Workflow
  •  Server-Side SDK
  •  Client-Side SDK
  •  Integration with External Applications
  • Cervo Technologies
    The Right Source to Outsource

    Sharepoint Portal Server KB

    Microsoft CRM Info

    WPF Interview Questions

    SilverLight Interview Qs

    Asp.Net 2.0 Interview Qs

    Asp.NET 1.1 FAQs

    Oracle Interview Questions

    SAP Interview Questions

    PHP Programming

    Passing an array as a hidden variable


    When I use the following syntax, the 2 dimensional array loses
    it's contents.  Can an array be passed this way?

       <? echo '<input type="hidden" name="attend_ary_save" value=' .
    $attend_ary_save .'>'; ?>

    Todd

    On Fri, 2007-05-11 at 21:53 -0700, Todd Cary wrote:
    > When I use the following syntax, the 2 dimensional array loses
    > it's contents.  Can an array be passed this way?

    >    <? echo '<input type="hidden" name="attend_ary_save" value=' .
    > $attend_ary_save .'>'; ?>

    No! RTFM!

    http://www.php.net/manual/en/language.types.type-juggling.php

    Cheers,
    Rob.
    --
    .------------------------------------------------------------.
    | InterJinn Application Framework - http://www.interjinn.com |
    :------------------------------------------------------------:
    | An application and templating framework for PHP. Boasting  |
    | a powerful, scalable system for accessing system services  |
    | such as forms, properties, sessions, and caches. InterJinn |
    | also provides an extremely flexible architecture for       |
    | creating re-usable components quickly and easily.          |
    `------------------------------------------------------------'

    -----------------------------------------------Reply-----------------------------------------------

    On May 12, 6:53 am, t@aristesoftware.com (Todd Cary) wrote:

    > When I use the following syntax, the 2 dimensional array loses
    > it's contents.  Can an array be passed this way?

    >    <? echo '<input type="hidden" name="attend_ary_save" value=' .
    > $attend_ary_save .'>'; ?>

    > Todd

    Dear Todd,

    you can, but you have to serialize it in some way. Using e.g.

    http://php.net/manual/en/function.serialize.php

    or create a sting containing your array as xml, or json, or any other
    suitable representation.

    good luck
       Martin

    ------------------------------------------------
    online accounting on bash bases
    Online Einnahmen-Ausgaben-Rechnung
    http://www.ea-geier.at
    ------------------------------------------------
    m2m server software gmbh
    http://www.m2m.at

    -----------------------------------------------Reply-----------------------------------------------

    hmmm,
    anyways, to do that you can just join the array using
    $str_attend_save = implode('|', $attend_ary_save);
    <? echo '<input type="hidden" name="str_attend_save" value=' .
    $str_attend_save .'>'; ?>

    On your action page, you do this:
    $attend_ary_save = explode('|', $_POST['str_attend_save']);

    --
    itoctopus - http://www.itoctopus.com

    "Todd Cary" <t@aristesoftware.com> wrote in message

    news:C3.71.20961.A3845464@pb1.pair.com...

    On Fri, May 11, 2007 11:53 pm, Todd Cary wrote:
    > When I use the following syntax, the 2 dimensional array loses
    > it's contents.  Can an array be passed this way?

    >    <? echo '<input type="hidden" name="attend_ary_save" value=' .
    > $attend_ary_save .'>'; ?>

    No.

    You'll just get "Array" back.

    You can do a few things:

    <?php
      foreach($attend_ary_save as $k1 => $v1){
        foreach($v1 as $k2 => $v2){
          ?><input type="hidden" name="attend_ary_save[<?php echo
    $k1?>][<?php echo $k2?>]" value="<?php echo $v2?>" /><?php
        }
      }
    ?>
    Actually, you should wrap htmlentities() around each value being
    echo-ed out.

    Another option is to http://php.net/serialize the data before you send
    it to HTML, and then (duh) unserialize it when it comes back.

    Or, be REALLY smart, and use session_start() and just put the array in
    $_SESSION and don't send data back-n-forth over HTTP, which is A)
    expensive, and B) subject to user tampering, and C) inefficient.

    Actually, A and C technically depend on your bandwidth versus hard
    drive speed, or wherever you store you session data, so, in theory, it
    could be cheaper or more efficient to use HTTP...  But I sure doubt it
    in any real world hardware setup.

    PS Just FYI, internally, PHP's session data is just serialized the
    same way you'd do it for HTTP.

    --
    Some people have a "gift" link here.
    Know what I want?
    I want you to buy a CD from some indie artist.
    http://cdbaby.com/browse/from/lynch
    Yeah, I get a buck. So?

    -----------------------------------------------Reply-----------------------------------------------

    Check out the 1st code example :

    http://www.php-code-search.com/?q=how%20to%20pass%20an%20array%20from...

    berber

    Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc