Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7848283
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T18:08:56+00:00 2026-06-02T18:08:56+00:00

I have a normal select box as can be seen below, in a separate

  • 0

I have a normal select box as can be seen below, in a separate class i have a number of php functions. I would like to be able to execute functions based on the select box.

<form action="functions.php" method"post">
<select name="sales">
  <option value="week">Last 7 days</option>
  <option value="month">Last 30 Days</option>
  <option value="year">Last 365 Days</option>
  <option value="all">Complete report</option>
</select>
<input type="submit" value="Submit" />
</form>

Then for example in my functions class i have functions function week(), function month(), function year(). I would like that when for example week is selected and submit is clicked that the week function would be executed, is there a simple method of doing this? Preferably on the same page but on a separate page would be fine.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T18:08:58+00:00Added an answer on June 2, 2026 at 6:08 pm

    what’s wrong with a simple if/else statement?

    if ( $_POST['select'] == 'year' ){ year(); }
    else if ( $_POST['select'] == 'month' ){ month(); }
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have turned a normal PHP class into a library so I can use
I have a normal HTML select dropdown box <select id=day name=day> <option value=0>All</option> <option
I have a normal textbox in my application. I can paste data to it
I have a search box where you can enter plain text. The keywords are
I have a normal gridview on asp.net web page... I want to select a
I have a normal notification system that looks like this: Notification notification new Notification(
With PHP I'm trying to run a SQL query and select normal columns as
Ok so I have a normal jQuery UI sortable, and I need to select
I Have a select box, on selectinga value in it I have to display
I know this is a daft question but I have a select box with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.