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

  • Home
  • SEARCH
  • 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 7956417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:59:01+00:00 2026-06-04T03:59:01+00:00

I have a form and the url for submitting the form will generated dynamicly

  • 0

I have a form and the url for submitting the form will generated dynamicly

var Var1 = new Array();
var Var2 = new Array();
if(Var1.length === 0)
$(this).attr('action', 'http://localhost/Method' ).submit();
if(Var1.length != 0 && Var2.length === 0)
$(this).attr('action', 'http://localhost/Method/Var1').submit();
if(Var1.length != 0 && Var2.length != 0)
$(this).attr('action', 'http://localhost/Method/Var1/Var2').submit();

and all that URLs fires one method in the server and it is

public function Method(){}
public function Method(Var1){}
public function Method(Var1 , Var2){}

is there anyway to make all the last 3 methods as one method? something like this:

public function Method(Var1, Var2){
    if(  condition for Var1 ){// doSomthing}
    if(  condition for Var2 ){// doSomthing}
}
  • 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-04T03:59:02+00:00Added an answer on June 4, 2026 at 3:59 am

    If you need this function for PHP, you can use func_get_arg and func_num_args:

    public function Method() {
        $numArguments = func_num_args();
    
        if ($numArguments >= 1) {
            $argument1 = func_get_arg(0);
            // Do something with argument 1
        }
    
        if ($numArguments >= 2) {
            $argument2 = func_get_arg(1);
            // Do something with argument 2
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Form element: $Form=new Zend_Form; $Form->setAction($this->view->url(array('controller'=>'auth','action'=>'create'),null,true)) ->setMethod('post') ->setAttrib('id','auth-form') ->removeAttrib('enctype'); As can be
I have this code below. I expected after submitting the form it goes to
I have an order submitting form where I want to replace URL texts with
I have form like this: <form method=POST action=<?php echo base_url() ?>admin/admin_search> <fieldset> <label for=nalozi>Nalozi</label><input
I have a website form that collects url of users to store in a
I am having problem with overriding Form Action URL I have a class to
hie i have a html form and while posting a request to a url
I have a simple form that looks like so <% remote_form_for post, :url =>
I have done the following form <% form_for @anexo, :url => {:action => create},
I have a form with many many fields... When submitting these fields, I use

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.