corillo181 Posted June 16, 2007 Share Posted June 16, 2007 how do i make the array looop start at any given point? $array=array(1=>'January','February','March','April','May','June','July','August','September','October','November','December'); foreach($array AS $key=>$value){ ?> <option value="<?=$key?>"><?=$value?></option> <? } ?> Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted June 16, 2007 Share Posted June 16, 2007 You could use a for loop. <?php $array=array(1=>'January','February','March','April','May','June','July','August','September','October','November','December'); //Where you want the array to start $start = 3; for($i = $start; $i < count($array); $i++){ ?> <option value="<?=$i ?>"><?=$array[$i] ?></option> <? } ?> Though I'm not sure what your doing, so this might not work out for your situation. Quote Link to comment Share on other sites More sharing options...
corillo181 Posted June 16, 2007 Author Share Posted June 16, 2007 the months are 12, and if i want the months to start from June to December i want to know how to start it from June and not from january Quote Link to comment Share on other sites More sharing options...
corillo181 Posted June 16, 2007 Author Share Posted June 16, 2007 but this does work fine for me.. Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted June 16, 2007 Share Posted June 16, 2007 Just change the $start variable to either 4 or 5 to start it from June. I'm not sure which one because you put the "1 =>" in there. Try both and see which works. Quote Link to comment Share on other sites More sharing options...
corillo181 Posted June 16, 2007 Author Share Posted June 16, 2007 but on the option selected when a person select a option should i use javascript to make it when selected do something because i think with php you have to submit before it can do any actions? Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted June 16, 2007 Share Posted June 16, 2007 Yeah, PHP requires a submit/page refresh. I'm not positive what your doing, but it sounds like it's a job for javascript. I would help you myself, but I'm not very good with javascript yet. Post in the javascript forum and someone will help you pretty fast, or maybe you can even find something on google? Quote Link to comment Share on other sites More sharing options...
corillo181 Posted June 17, 2007 Author Share Posted June 17, 2007 yeah the thing is i don't really like javascript too much because a lot of people has it off, but i guess i can post a javascript must be on for the page. but my idea is. have 3 list menu [year] [month] [day] but when someone goes in to the page only going to see year list [year] once year is selected the month will appear [2007][month] once the month is selected the day will become available [2007[june][day] and when they select the day. they can submit. Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted June 17, 2007 Share Posted June 17, 2007 Yeah...post this in the javascript forum. I would probably be able type out a foundation code for you, but it would probably take me like 45 minutes, and I don't have the time right now. Someone in the JS forum will probably be able to show you in 5 minutes, hah. Don't forget to put this topic as "solved" Quote Link to comment Share on other sites More sharing options...
corillo181 Posted June 17, 2007 Author Share Posted June 17, 2007 thank you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.