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 9221005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:28:50+00:00 2026-06-18T03:28:50+00:00

<form method=’GET’ name=’search’ action=’index.php’> <input type=hidden name=searchType value=all /> <input type=checkbox name=vehicle value=first/> <input

  • 0
<form method='GET' name='search' action='index.php'> 
    <input type="hidden" name="searchType" value="all" />
    <input type="checkbox" name="vehicle" value="first"/> 
    <input type="checkbox" name="vehicle" value="second" checked/> 
</form>

<a href="javascript:document.search.submit()"></a>

From the form above, I want the URL data to be index.php/searchType=all when first checkbox is checked and URL data to be index.php/ (to be empty) if second checkbox is checked. How am I going to do that? Is it possible to on or off the “hidden” parameter as the example above? I don’t want it to be index.php/searchType= when second checkbox is checked but to remove the whole parameter name.


This is second question:

I want to inject some parameters in the Form Action, how could I do that? Is it looked something like this:

<a href="javascript:injectParameter();document.search.submit()"></a>

What am I supposed to write in the injectParameter() method?

Sorry about I am quite new in Javascript and web.

  • 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-18T03:28:52+00:00Added an answer on June 18, 2026 at 3:28 am

    I think, if you don’t want the input fields to show up in the URL, you can remove them from the form before posting.

    Untested:

    var objForm = document.search;
    if (objForm.vehicle.checked)
        {
        objForm.removeChild(objForm.searchType);
        objForm.submit();
        }
    

    Is that your goal?

    Also multiple fields with the same name doesn’t work this way.

    you’ll maybe want to use radiobuttons like so:

    <input type="radio" name="vehicle" value="all" />
    <input type="radio" name="vehicle" value="first"/> 
    <input type="radio" name="vehicle" value="second" selected /> 
    

    or create an array of fields like so:

    <input type='checkbox' name='vehicle[]' value='first' />
    <input type='checkbox' name='vehicle[]' value='second' checked />
    

    I hope this helps…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I do have a search form. <form method=get id=searchform action=<?php bloginfo('siteurl');?>> <div class=search_bx1><input type=text
I have navigation form with 4 submit buttons. <form action=index.php?do=move method=post> <center> <input name=north
I am trying to submit a form with method GET and action index.php?id=3. The
form html: <form action='/register/' method = 'post'>{% csrf_token %} ... <label>Avatar: </label><input type='file' name='avatar'
<form method = post action = <?php echo $_SERVER['PHP_SELF']; ?> /> Username:<input type =
I have a simple form method... <form method=POST action=j_security_check> <table> <tr> <td>Name:</td> <td><input type=text
Consider the following Mechanize form object #<Mechanize::Form {name f1} {method POST} {action f.php} {fields
Getting variable from form: <form method = 'POST' action = ''> <input type =
<?php $var = arbitrary; echo <<<_END <form method = post action = feed.php> <input
If I set my Form method to GET it will send the action page

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.