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)

    Outputting list of variables in a select

    Hi all,
    I am trying to output a list of values in a select.
    I don't get an error but it doesn't show anything, why is that? Thank you

    PHP Code:
    <form action="ws.php" method="get">
    <p>
    Convert from:

    <?php
    require_once 'lib/nusoap.php';

    $oClient   = new nusoap_client(
        
    'http://www.webservicex.net/CurrencyConvertor.asmx?WSDL',
        
    TRUE // Needs to be TRUE because we are using WSDL
    );
    $oResponse $oClient->call(
        
    'Currency',
        array(
            
    'FromCurrency' => 'USD',
            
    'ToCurrency'   => 'CAD'
        
    )
    );

    echo 
    $fCurrency



    ?>

    <select name="FromCurrency">
    <option value="<?php print_r($fCurrency);?>"><?php print_r($fCurrency); ?></option>
    </select>
    </p>

    <input type="submit" />

     </form>

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I don't think print_r is what you intended to use here. Its output within the value attribute of the option element would not be valid HTML.

    Additionally, $fCurrency is not assigned a value anywhere in your code

  3. #3
    SitePoint Evangelist
    Join Date
    Mar 2008
    Posts
    551
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the reply Dan, should I use echo instead then?

    I was able to output all the vars using this code:
    <?php
    $vars = get_defined_vars();
    print_r($vars);
    ?>

    How do I output only the webservice vars? Thanks
    Last edited by Bayliss Trevor; May 1, 2009 at 19:20. Reason: replied with an ipod before couldnt type properly!


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
  •