Skip to main content
MischaKemna
Participating Frequently
April 10, 2018
Answered

Form

  • April 10, 2018
  • 1 reply
  • 640 views

Hi Dreamweavers!

I‘m not quite sure how to explain it, but I want to do the following:

For example, when someone types ‘apples’ I want my site to go to domain.com/apples, or when someones types ‘bananas’ I want the site to go to domain.com/bananas.

I don’t know if this is even possible, I tried looking for it on the internet, but I couldn’t quite figure out how to phrase the issue.

If it is possible, I would love to learn how. If it’s not, I’d like to know too, then I can stop thinking about it.

Thanks people!

    This topic has been closed for replies.
    Correct answer osgood_

    MischaKemna  wrote

    Then I would like the site to go to domain.com/rubbish. So basically each input should have it’s own result. It’s so a company can enter their company name and then the site shows a specific page for them.

    You can do that. I'm assuming the specific company pages are all housed on your website. See code below.

    For testing make a page called adobe_dreamweaver.html (this is a company page - use underscores between words in a url, its good practice to do so) then use the below code for the search code.....this search code can go in any page you want. If a company name match is found the company page will open, if a match is not found an error page will appear, you will need to set a default error page up on you server, if there isnt already one.

    <!DOCTYPE html>

    <html>

    <head>

    <meta charset="UTF-8">

    <title>Search company name</title>

    <script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="

    crossorigin="anonymous"></script>

    <script>

    $(document).ready(function(){

    $('.search_company_name').css('cursor' , 'pointer').click(function(){

    let company_name = $('.company_name').val();

    company_name = company_name.replace(/\s+/g, '_');

    company_name = company_name.toLowerCase();

    window.location = company_name + '.html';

    });

    });

    </script>

    </head>

    <body>

    <input type="text" class="company_name" placeholder="Company Name">

    <input type="submit" name="submit" class="search_company_name" value="Search">

    </body>

    </html>

    1 reply

    BenPleysier
    Community Expert
    Community Expert
    April 10, 2018

    Not sure what you want to do. If I type 'rubbish' where do you want the site to go?

    Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
    MischaKemna
    Participating Frequently
    April 10, 2018

    Then I would like the site to go to domain.com/rubbish. So basically each input should have it’s own result. It’s so a company can enter their company name and then the site shows a specific page for them.

    osgood_Correct answer
    Legend
    April 10, 2018

    MischaKemna  wrote

    Then I would like the site to go to domain.com/rubbish. So basically each input should have it’s own result. It’s so a company can enter their company name and then the site shows a specific page for them.

    You can do that. I'm assuming the specific company pages are all housed on your website. See code below.

    For testing make a page called adobe_dreamweaver.html (this is a company page - use underscores between words in a url, its good practice to do so) then use the below code for the search code.....this search code can go in any page you want. If a company name match is found the company page will open, if a match is not found an error page will appear, you will need to set a default error page up on you server, if there isnt already one.

    <!DOCTYPE html>

    <html>

    <head>

    <meta charset="UTF-8">

    <title>Search company name</title>

    <script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="

    crossorigin="anonymous"></script>

    <script>

    $(document).ready(function(){

    $('.search_company_name').css('cursor' , 'pointer').click(function(){

    let company_name = $('.company_name').val();

    company_name = company_name.replace(/\s+/g, '_');

    company_name = company_name.toLowerCase();

    window.location = company_name + '.html';

    });

    });

    </script>

    </head>

    <body>

    <input type="text" class="company_name" placeholder="Company Name">

    <input type="submit" name="submit" class="search_company_name" value="Search">

    </body>

    </html>