foreach() result as a $varaible ( 3 Views )

no kitty!
  1. Here is a simple script I made to help me understand how foreach works. How can I store the output of the foreach to a $varaible (not an array). All the examples of foreach i see only show how to store it into mysql in a bad way or echo it out.
    Thanks for your help.
    PHP Code:

    <FORM METHOD="POST" ACTION="<? echo $PHP_SELF?>">
    <select name="resolutionarray[]" size="13" multiple="multiple" tabindex="6">
    <option value="All" selected="selected">All</option>
    <option value="640x480 ">640x480</option>
    <option value="800x600 ">800x600</option>
    <option value="1024x768 ">1024x768</option>
    <option value="1152x864 ">1152x864</option>
    <option value="1280x720 ">1280x720</option>
    <option value="1280x768 ">1280x768</option>
    <option value="1280x960 ">1280x960</option>
    <option value="1280x1024 ">1280x1024</option>
    <option value="1360x768 ">1360x768</option>
    <option value="1600x900 ">1600x900</option>
    <option value="1600x1024 ">1600x1024</option>
    <option value="1600x1200 ">1600x1200</option>
    </select>
    <INPUT TYPE="submit" NAME="submit" VALUE="Submit">
    </form>
    <?
    $resolutionarray
    = $HTTP_POST_VARS['resolutionarray'] ;
    foreach(
    $resolutionarray as $resolution) {
    echo
    "$resolution "; }
    ?>


    (Erbil, Saint Pierre and Miquelon)

  2. PHP Code:

    $str = '';
    foreach(
    $resolutionarray as $resolution) {
        
    $str .=  $resolution;
    }


    (Aslan, Cocos (Keeling) Islands)

  3. Wow that was fast. Thank you Gaheris!

    [update] works perfect! thanks again

    (ferit, Chile)



Related Topics ... (or search in 1.720.883 topics !)

$_session varaible issue (5)
parsing varaible from database (3)
assigning a random value to a varaible (5)
trouble passing a varaible to a class (7)
passing a varaible to another script using href (3)
js varaible to cold fusion variable (5)
assign varaible to html outside of <?php ?> (12)
passing a hidden varaible to another script using a hyperlink (16)
simple passing of varaible to another html page (2)




copyright © 2007-2031 Pfodere.COM ( 8 Pfoyihuee Online )

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 
0.7626