Jump to content

[SOLVED] array


corillo181

Recommended Posts

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>
<?
}
?>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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"

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.