www.webdeveloper.com
Results 1 to 2 of 2

Thread: [RESOLVED] Trying to select an option with PHP

  1. #1
    Join Date
    Jun 2012
    Location
    FL, USA
    Posts
    48

    resolved [RESOLVED] Trying to select an option with PHP

    Ok, i just totally simplified it. I've got it narrowed to this:


    Code:
    <?php
    $timeout4 = '17:00';
    
    $inorout = 'out';
    $x = 4;
    
    $it = 'time'.$inorout.$x;
    print $it; // works... prints timeout4
    print "<br />";
    print ${$it}; // also works... prints 17:00
    
    if (${$it} == "17:00") print ${$it}; // WORKS. prints 17:00
    
    
    //HERE is the problem. When $h hits 17, the if() should fire true. Well it doesn't and only prints the non-selected option
    
    for ($h = 6; $h <= 22; $h++)
    {
    	if (${$it} == '$h:00') {$output = "<option value='$h:00' selected='selected'>$h:00</option>";}
    	else { $output = "<option value='$h:00'>$h:00</option>"; }
    }
    echo $output;
    Last edited by captainscall; 07-22-2012 at 05:07 PM.

  2. #2
    Join Date
    Jun 2012
    Location
    FL, USA
    Posts
    48
    OH MY GOSH. I have spend hours on this confounding problem and found that FIREFOX is to blame.

    The script runs completely fine on IE. It was because I didn't declare a DOCTYPE in firefox.

    Goodness... gracious...

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles