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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:46:19+00:00 2026-05-20T11:46:19+00:00

<?php echo $this->getUrl(); ?> gives me my index page url .i.e. www.domain.com/index.php/ But now,

  • 0

<?php echo $this->getUrl(); ?> gives me my index page url .i.e. http://www.domain.com/index.php/

But now, what I want is, when any particular option is selected, it should add to this url.
.e.g.

www.domain.com/index.php/wordpress/

I write this code for it but now don know how to get it done. 🙁

<select onchange="setLocation('<?php echo $this->getUrl(); ?>')">
     <option value="">&nbsp;</option>
     <option value="wordpress">Wordpress</option>
     <option value="drupal">drupal</option>
     <option value="magento">Megento</option>
</select>

Also, I had searched this link but couldn’t take help from it. As it didnt work for me.

<select name="forma" ONCHANGE="location = this.options[this.selectedIndex].value;">
 <option value="Home">Home</option>
 <option value="Contact">Contact</option>
 <option value="Sitemap">Sitemap</option>
</select>
  • 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-20T11:46:20+00:00Added an answer on May 20, 2026 at 11:46 am

    With this (note that I’ve added this as the first argument):

    <select onchange="setLocation(this, '<?php echo $this->getUrl(); ?>')">
         <option value="">&nbsp;</option>
         <option value="wordpress">Wordpress</option>
         <option value="drupal">drupal</option>
         <option value="magento">Megento</option>
    </select>
    

    You could write the following JS:

    function setLocation(elm, baseUrl) {
        var keyword = elm.options[elm.selectedIndex].value; // Gets the selected keyword (some sanity check could be done)
        window.location = 'http://' + baseUrl + keyword + '/'; // Redirects
    }
    

    Alternatively:

    <select name="forma" onchange="window.location='http://<?php echo $this->getUrl(); ?>' + this.options[this.selectedIndex].value + '/';">
     <option value="Home">Home</option>
     <option value="Contact">Contact</option>
     <option value="Sitemap">Sitemap</option>
    </select>
    

    (EDIT Prepended http:// to both examples.)

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

Sidebar

Related Questions

Given this PHP code: <a onclick=javascript:window.location.href='<?php echo $url;?>' What if there is a '
Let's say I do a simple AJAX request (in jQuery) like geturl.php?url=http://google.com and geturl.php
For example… This PHP code <?php echo '<html>'; echo '<body>'; echo '<h1>Header One</h1>'; echo
this is my HTML: <?php echo form_open(base_url().'admin'); ?> <div class=row username> <span class=icon></span> <input
Imagine this simple form <form action=<?php echo $_SERVER['REQUEST_URI']; ?> method=post> <fieldset> <legend>Contact Me</legend> <label
$.post('includes/script.php', $(this).serialize(), function(data) { $('body').append(data); }); alert ($('#new').length) php script is <php echo <div
I have the dropdown list like this <?php echo $form->dropdownList($customers,'customer_name', CHtml::listData(Customers::model()->findAll(), 'id', 'customer_name'), array(
I have code like this: <?php if(isset($global_info_results)): ?> <?php echo count($global_info_results) ?> <span>Mali Oglasi:
I have this code snippet in an email layout: <div> <?php echo $this->Html->image('Layouts/default/Logo.png', array(
I use <?php echo __("this is my string"); ?> inside my views to display

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.