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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:01:14+00:00 2026-05-22T16:01:14+00:00

Using smarty, take a look at the code below: <select name=unitSelect class=uniForm id=unitSelect style=width:1250px;

  • 0

Using smarty, take a look at the code below:

            <select name="unitSelect" class="uniForm" id="unitSelect" style="width:1250px;" onchange="location.href='{$ABS_MANAGER_URL}/managerEditUnit.php?unit_id={$set[i].id}'; return false">
                    <option value="0" selected="selected">Select Unit</option>
                {section name=i loop=$set}
                    <option value="{$set[i].id}" >{$set[i].unitName}</option>
                {/section}
            </select>

What I want, is for the value in the options to load into the select onchange”” call, for the GET variable… I can’t figure out how to do this with javascript…any ideas anyone?

Thanks.


UPDATE

It wasn’t easy, but between a few of your comments I got one working, thanks all:

<script type="text/javascript">
    function viewUnit(value) {

        var url = "managerEditUnit.php?unit_id="; 
        url += value;
        document.location.href=url;
    }
</script> 
  • 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-22T16:01:15+00:00Added an answer on May 22, 2026 at 4:01 pm

    Here is an example:

    <select onchange="alert(this.options[this.selectedIndex].value)">
        <option value="0">Option 1</option>
        <option value="1">Option 2</option>
        <option value="2">Option 3</option>
    </select>
    

    EDIT:

    Sorry for the duplicate.

    If you want to use it with a function:

    function yourfunction(value) {
        alert(value);
    }
    

    And ofcourse change alert in the above HTML to yourfunction.

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

Sidebar

Related Questions

Im using smarty and mysql_real_escape_string() for user input, and when I insert some code
I'm using Smarty templates which call object methods. I've put the code on a
I found that using Smarty with PHP, sometimes extra time will need to be
I'm using smarty for my site, and I'm trying to loop through an array
Are there any good Eclipse plugins for creating smarty templates? I am using Europa
This is yet another of my Java questions. Please take a look at this
I am trying to write an optimized code that renders a 3D scene using
We are using Smarty Templates on our LAMP site but my question would also
I'm using Smarty and PHP. If I have a template (either as a file
I am using smarty gettext plugin to internationalize smarty templates on windows. But when

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.