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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:58:44+00:00 2026-06-12T04:58:44+00:00

I have a form like this <html> <body> <form action=” name=’myform’ method=’POST’> <input type=’text’

  • 0

I have a form like this

<html>
    <body>
    <form action='' name='myform' method='POST'>
    <input type='text' name='cars'>
    <button action='submit'>Search Cars</button>
    </body>
</html>

What I want to do is change the form action to be something like action='http://www.mysite.com/<cars_value>.html'> based on whatever is filled into the input field (which is populated by autocomplete).

Is there an easy way of doing this? I can do it with a <select> easily enough but the customer wants an input field instead!

  • 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-12T04:58:45+00:00Added an answer on June 12, 2026 at 4:58 am

    You can do this, you will need to add ids to items. One thing you might want to do is validate the users input.

    HTML

    <form action='' name='myform' id="myform" method='POST'>
      <input type='text' name='cars' id="cars">
      <button action='submit'>Search Cars</button>
    </form>
    

    jQuery

    $('#myform').submit(function(){
      var car = $('#cars').val();
      $(this).attr('action', "http://www.mysite.com/" + car + ".html");
    }); 
    

    EDIT:
    It is best to be javascript at bottom of page;

    FULL

    <!DOCTYPE HTML>
    <html lang="en-US">
    <head>
      <meta charset="UTF-8">
      <title></title>
    </head>
    <body>
      <form action='' name='myform' id="myform" method='POST'>
        <input type='text' name='cars' id="cars">
        <button action='submit'>Search Cars</button>
      </form>
      <script src="path-to-jquery"></script>
      <script>
      // Shorthand for $(document).ready();
      $(function() {
       $('#myform').submit(function(){
         var car = $('#cars').val();
         $(this).attr('action', "http://www.mysite.com/" + car + ".html");
       });
      });
     </script>
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given HTML like this: <body> <form name=myForm action=savedata.php method=post> <input type=text name=myName /> </form>
I have a php page like this : <html> <body> <form method=post action=catch_combo.php> <select
I have a form like this: <form action=form_send.php method=post> <table> <tr> <td><label for=address>address</label></td> <td><input
I have an HTML form that needs multiple submit buttons, like this: <input type=submit
I have form like this: <div class=satu> <input type='text' size='1' maxlength='1' name='score[1][]' id='score[1][]'> </div>
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 an HTML form like this: form.html: <html> <body> your name is :<br><br>
I have a form in a .html files where input/select box looks like this
I have a simple html form that is structured something like this: <form name=test
I have webpage with a form like this: <html> <head> ... </head> <body> <form

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.