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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:01:24+00:00 2026-05-28T03:01:24+00:00

In index.php I have a form: <form name=UserLocation action=propForSale.php method=GET> Once the user types

  • 0

In index.php I have a form:

<form name="UserLocation" action="propForSale.php" method="GET">

Once the user types in the name of a location in the text box on the form, they click on the “For Sale” submit button:

<input type="submit" value="For Sale" />

This takes the user to propForSale.php page as specified in the action attribute.
But I now have another button on the form in index.php:

<input type="submit" value="To Rent" />

I now want the user to be directed to “propToRent.php” when they click on the “To Rent” button.

At the moment, it take the user to “propForSale.php” when they click on the “To Rent” button. This is probably because it is specified in the action attribute of the form to go to that particular page. But how do I get it to go to “propToRent.php”?

Thanks in advance

  • 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-05-28T03:01:24+00:00Added an answer on May 28, 2026 at 3:01 am

    You can have two buttons and use Javascript to change the action of form and submit it to different pages, but I think the drop-down menu is the simpler solution. Anyway, to use two buttons you’ll need something like:

    <form id="userLocation" action="" method="get">
    <p>
        <label for="field1">Field 1:</label>
        <input type="text" id="field1" name="field1" />
    </p>
    <p>
        <label for="field2">Field 2:</label>
        <input type="text" id="field2" name="field2" />
    </p>    
    <p>
        <input type="button" value="For Sale" onclick="submitForm('forSale.php')" />
        <input type="button" value="To Rent" onclick="submitForm('toRent.php')" />
    </p>
    </form>
    <script type="text/javascript">
    function submitForm(action) {
        form = document.getElementById('userLocation');
    
        form.action = action;
        form.submit();
    }
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

<form action=index.php?page=checkin method=post name=regForm> Fullständiga namn: <input name=full_name type=text id=full_name class=required> <br > Email:
I have a form to upload image like below <form name=sample enctype=multipart/form-data action=index.php method=post
I have a form in index.php <?php echo '<form action=update_act.php method=POST>'; echo '<input type=submit
I have form in my html page <form id=login_form method=POST action=index.php> <table> <tr> <td><label
I have a post html form, and the action is index.php, which is the
In index.php I have a form and in the form a text field: <form
Let's say we have index.php and it is stored in /home/user/public/www and index.php calls
I have an index.php file which has to process many different file types. How
I have an index page index.php , and when the user clicks on a
Here's my problem: I have a form in index.html, it will have a text

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.