arjay_comsci Posted September 8, 2009 Share Posted September 8, 2009 hi guys,,i had this problem,,I want to make a function for the days but the days has the equivalent values..... 1-Sunday 4-Wednesday 2-Monday 5-Thursday 3-Tuesday 6-Friday and 7-Saturday and also for the visibility 1-Active 2-Inactive No database had been query on it..So its just a function but the output would be the days and not the numbers.. hope you'll help me.. Quote Link to comment Share on other sites More sharing options...
Psycho Posted September 8, 2009 Share Posted September 8, 2009 You are going to have to try and rephrase your question as it is not at all clear what you are trying to achieve. Quote Link to comment Share on other sites More sharing options...
arjay_comsci Posted September 8, 2009 Author Share Posted September 8, 2009 how can I make functions on that,,to display the value of days in the dropdown box Quote Link to comment Share on other sites More sharing options...
play_ Posted September 8, 2009 Share Posted September 8, 2009 $days = array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'); foreach( $days as $k => $v ) { echo "$v <br />"; } Assuming that's what you're asking for. Was really unclear. Quote Link to comment Share on other sites More sharing options...
gr1zzly Posted September 8, 2009 Share Posted September 8, 2009 Ok, hard to understand this but here goes... If you need a 'dropdown box' then why not use the html form <SELECT> element and if no db access is required why not just hard code the menu with html? Of course if you wanted you could use php to output the select menu by doing something like echo "<select name='a_name'>"; then as play_ suggested use a FOR or FOREACH loop to write out the options, e.g. for ($i = 1; $i <= 7; $i++) { echo "<option value='day_value'>Day Name</option>"; } </select> but the effect is the same so why bother using php unless you have to, like if it absolutely needs to be sever side or if it offers function that you cannot provide using basic html and/or javascript! Quote Link to comment Share on other sites More sharing options...
arjay_comsci Posted September 9, 2009 Author Share Posted September 9, 2009 thank you guys for your help 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.