Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to change list box 1

Status
Not open for further replies.

vba317

Programmer
Mar 5, 2009
708
US
I have a PHP that I want to modify. I am not sure how I would start. Currently the box will display the numbers 1 -31. I would like it to display 1-15 than 27 -31. I have never programmed in PHP before.Is this possible? Any help would be appreciated.
Tom

Code:
// Default Close Day
			$sel_cldy="<select name='zcldy' size='1'>";
            for ($i = 1;$i < 32;$i++) {
                if($cl_cldy==$i) {
                    $sel_cldy.="<option selected value='".$i."'>".$i."</option>";
                } else {
                    $sel_cldy.="<option value='".$i."'>".$i."</option>";
                }
            }
            $sel_cldy.="</select>";

 
Hi

You mean to skip the 16..26 interval ? I think the simplest is this way :

PHP:
[navy]$sel_cldy[/navy][teal]=[/teal][i][green]"<select name='zcldy' size='1'>"[/green][/i][teal];[/teal]
[b]for[/b] [teal]([/teal][navy]$i[/navy] [teal]=[/teal] [purple]1[/purple][teal];[/teal][navy]$i[/navy] [teal]<[/teal] [purple]32[/purple][teal];[/teal][navy]$i[/navy][teal]++)[/teal] [teal]{[/teal]
    [highlight][b]if[/b] [teal]([/teal][navy]$i[/navy] [teal]>[/teal] [purple]15[/purple] [teal]&&[/teal] [navy]$i[/navy] [teal]<[/teal] [purple]27[/purple][teal])[/teal][/highlight]
        [highlight][b]continue[/b][teal];[/teal][/highlight]

    [b]if[/b][teal]([/teal][navy]$cl_cldy[/navy][teal]==[/teal][navy]$i[/navy][teal])[/teal] [teal]{[/teal]
        [navy]$sel_cldy[/navy][teal].=[/teal][i][green]"<option selected value='"[/green][/i][teal].[/teal][navy]$i[/navy][teal].[/teal][i][green]"'>"[/green][/i][teal].[/teal][navy]$i[/navy][teal].[/teal][i][green]"</option>"[/green][/i][teal];[/teal]
    [teal]}[/teal] [b]else[/b] [teal]{[/teal]
        [navy]$sel_cldy[/navy][teal].=[/teal][i][green]"<option value='"[/green][/i][teal].[/teal][navy]$i[/navy][teal].[/teal][i][green]"'>"[/green][/i][teal].[/teal][navy]$i[/navy][teal].[/teal][i][green]"</option>"[/green][/i][teal];[/teal]
    [teal]}[/teal]
[teal]}[/teal]
[navy]$sel_cldy[/navy][teal].=[/teal][i][green]"</select>"[/green][/i][teal];.[/teal]


Feherke.
feherke.ga
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top