Jump to content

[SOLVED] Need Simple Help on Functions


arjay_comsci

Recommended Posts

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..

Link to comment
Share on other sites

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!

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.