Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Echo Option Value

Featured Replies

Can anyone PLEASE tell me how to echo the Option value to show as class="select-box-label">OPTION VALUE<

 

It's just towards the end on the code below ...

 

Really appreciate any help .. Thanks

 

 

<script type="text/javascript">
    $(document).ready(function(){
        $("#make").change(function(){
            var make_id = $(this).val();
            var url = '<?php echo osc_ajax_plugin_url('cars_attributes/ajax.php') . '&makeId='; ?>' + make_id;
            var result = '';
            if(make_id != '') {
                $("#model").attr('disabled',false);
                $.ajax({
                    type: "POST",
                    url: url,
                    dataType: 'json',
                    success: function(data){
                        var length = data.length;
                        if(length > 0) {
                            result += '<option value="" selected><?php _e('Select a model', 'cars_attributes'); ?></option>';
                            for(key in data) {
                                result += '<option value="' + data[key].pk_i_id + '">' + data[key].s_name + '</option>';
                            }
                        } else {
                            result += '<option value=""><?php _e('No results', 'cars_attributes'); ?></option>';
                        }
                        $("#model").html(result);
                    }
                 });
             } else {
                result += '<option value="" selected><?php _e('Select a model', 'cars_attributes'); ?></option>';
                $("#model").attr('disabled',true);
                $("#model").html(result);
             }
        });
    });
</script>
<h2><?php _e('Car Details', 'cars_attributes') ; ?></h2>
<div>
    <div class="control-group">
        <?php
            if( Session::newInstance()->_getForm('pc_make') != '' ) {
                $detail['fk_i_make_id'] = Session::newInstance()->_getForm('pc_make');
            }
        ?>
        <label class="control-label"><?php _e('Make', 'cars_attributes'); ?></label>
        <div class="controls">
        <div class="select-box ">
        <select name="make" id="make" style="opacity: 0;">
        <option value="" selected><?php _e('Select a make...', 'cars_attributes'); ?></option>
        <?php foreach($makes as $a){ ?>
        <option value="<?php echo $a['pk_i_id']; ?>" <?php if(@$detail['fk_i_make_id'] == $a['pk_i_id']) { echo 'selected'; } ?>><?php echo $a['s_name']; ?></option>
          <?php } ?>  
        </select>
        <a href="#" class="select-box-trigger"><span class="select-box-label">DYNAMICALLY APPLY LABEL HERE BASED ON SELECT VALUE</span><span class="select-box-icon">0</span></a>
        
        </div>
        </div>
    </div>

 

 

You already have done this in your code!

 

<option value="<?php echo $a['pk_i_id']; ?>" <?php if(@$detail['fk_i_make_id'] == $a['pk_i_id']) { echo 'selected'; } ?>><?php echo $a['s_name']; ?></option>

 

This works the same... If I understand what you mean....

  • Author

Greatly appreciate your response, but i need to echo the value as a label in the span tags below it.

This is not my design, so it is a little unconventional. There is styling applied to the select box which only works by setting an opacity on the select box, which then also makes the select values also invisible.

 

So the label is called in another div below

 

<a href="#" class="select-box-trigger"><span class="select-box-label">DYNAMICALLY APPLY LABEL HERE BASED ON SELECT VALUE</span><span class="select-box-icon">0</span></a>

 

So basically where i have DYNAMICALLY APPLY LABEL HERE BASED ON SELECT VALUE .. i would like to place some code to echo the value to be used as a label.

 

Do you get me ?

Do you mean, when you change the select box, you want it's value or label to be displayed in the span you've designated?

 

Something like this? http://jsfiddle.net/LyndseyB/fDJmw/. Change the option to see what happens.

 

If so, you would need to add the following to your jQuery, inside the change() function:

 

thisVal = $('option:selected', this).text();
$('.select-box-label').html(thisVal);
  • Author

Lyndsey that appears to be exactly what i am looking for .. Unfortunately i have no idea where to place it. I am a total newbie !! I didn't actually write the code above, i am just trying to modify ! Can you point me in the right direction ?

 

Thank you soooo much for your help !

Hey, here's the full code:

 

<script type="text/javascript">
    $(document).ready(function(){
        $("#make").change(function(){
            var thisVal = $('option:selected', this).text();
            $('.select-box-label').html(thisVal);
            var make_id = $(this).val();
            var url = '<?php echo osc_ajax_plugin_url('cars_attributes/ajax.php') . '&makeId='; ?>' + make_id;
            var result = '';
            if(make_id != '') {
                $("#model").attr('disabled',false);
                $.ajax({
                    type: "POST",
                    url: url,
                    dataType: 'json',
                    success: function(data){
                        var length = data.length;
                        if(length > 0) {
                            result += '<option value="" selected><?php _e('Select a model', 'cars_attributes'); ?></option>';
                            for(key in data) {
                                result += '<option value="' + data[key].pk_i_id + '">' + data[key].s_name + '</option>';
                            }
                        } else {
                            result += '<option value=""><?php _e('No results', 'cars_attributes'); ?></option>';
                        }
                        $("#model").html(result);
                    }
                 });
             } else {
                result += '<option value="" selected><?php _e('Select a model', 'cars_attributes'); ?></option>';
                $("#model").attr('disabled',true);
                $("#model").html(result);
             }
        });
    });
</script>
<h2><?php _e('Car Details', 'cars_attributes') ; ?></h2>
<div>
<div class="control-group">
<?php
if( Session::newInstance()->_getForm('pc_make') != '' ) {
$detail['fk_i_make_id'] = Session::newInstance()->_getForm('pc_make');
}
?>
<label class="control-label"><?php _e('Make', 'cars_attributes'); ?></label>
<div class="controls">
<div class="select-box ">
<select name="make" id="make" style="opacity: 0;">
<option value="" selected><?php _e('Select a make...', 'cars_attributes'); ?></option>
<?php foreach($makes as $a){ ?>
<option value="<?php echo $a['pk_i_id']; ?>" <?php if(@$detail['fk_i_make_id'] == $a['pk_i_id']) { echo 'selected'; } ?>><?php echo $a['s_name']; ?></option>
<?php } ?> 
</select>
<a href="#" class="select-box-trigger"><span class="select-box-label">DYNAMICALLY APPLY LABEL HERE BASED ON SELECT VALUE</span><span class="select-box-icon">0</span></a>

</div>
</div>
</div>

 

Note, I've just added my two lines of code in to your <script> block underneath $('#make').change(function() ....

 

Try that out :)

  • Author

AHHH .. Ok on first impressions it worked, but then i realised it changes the value on all select boxes .. there are multiple select boxes on the page .. My bad .. i probably should have told you that !!

 

Sorry

AHHH .. Ok on first impressions it worked, but then i realised it changes the value on all select boxes .. there are multiple select boxes on the page .. My bad .. i probably should have told you that !!

 

Sorry

 

I'm a little confused now :p

 

The code you've shown should only apply to the one select box... #make. When that changes, the span is updates with it's selected value.

 

Does changing other selects on the page also change the text inside the span? Is that what you mean? Or, do you have multiple <span> elements with the class 'select-box-label'?

Edited by Lyndsey

  • Author

Yeh, basically what ever i select in #make, is applied to other select boxes. See attached image.

 

You will see that the selects from Car type down have not had the opacity applied, so they are showing the correct value as any normal select box would but every box with a grey background is using this unconventional method.

 

screen.png

Have you got a live link to this in effect? I'd just like to see exactly what's happening and what the code looks like, if possible.

  • Author

Yes no problem .. You will need to sign in, but you can use the test user details below or feel free to login with Facebook.

 

URL: http://ads-ni.co.uk/user/login

 

user=admin@ultrawebtemplates.com

pass=123456

 

Then you will need to hit "Publish Your Ad For Free"

On the listing page Select Vehicles from the Category, to load this part of the form. As you can see under Car Details, the first 2 selects have opacity set but the others do not.

And your proposed jQuery edit is still in place !!

 

Sorry i couldn't make access simpler, really appreciate your help on this !!

Thanks for that.

 

Ok, from what I can see, each <select> box label uses the same class, so every time you're changing the Make dropdown, the other select boxes are acquiring the current selected value.

 

So, to clarify, what exactly do you want the #make dropdown to do?

 

For now, remove the two lines of code I gave you, because I'm not sure it's what you're after. I think I've got the wrong end of the stick here :p If you can give me some more information about what you're trying to achieve, that'd be great :)

 

Remove this:

 

var thisVal = $('option:selected', this).text();
$('.select-box-label').html(thisVal);
  • Author

Thanks for your time .. I really do appreciate it ... Basically in the code below there are 11 Select boxes and a number of input boxes. This is the section of the form specifically for Car Details ... As i said before the select boxes work correctly, but the opacity makes it invisible. So basically i want to somehow apply the option value to the span class on each select box .... basically the same technique is used (and working) on the upper part of the form, but i am trying to make a plugin function in the same way unfortunately the upper part is so difficult to get to the source of. I'll show some code from it show you what i mean.

 

So a select box on the working form is like so


<div class="control-group">
                              <label class="control-label" for="country"><?php _e('Country', 'bender'); ?></label>
                              <div class="controls">
                                <?php ItemForm::country_select(osc_get_countries(), osc_user()); ?>
                              </div>
                            </div>

 

 

 

But that outputs html like so ..

<div class="control-group">
                              <label class="control-label" for="country">Country</label>
                              <div class="controls">
                                <div class="select-box undefined"><select name="countryId" id="countryId" style="opacity: 0;"><option value="">Select a country...</option><option value="IE">Ireland</option><option value="NI">Northern Ireland</option></select><a href="#" class="select-box-trigger"><span class="select-box-label">Select a country...</span><span class="select-box-icon">0</span></a></div>                              </div>
                            </div>

 

So basically i am trying to do the same with the following page

 

<script type="text/javascript">
    $(document).ready(function(){
        $("#make").change(function(){
            var make_id = $(this).val();
            var url = '<?php echo osc_ajax_plugin_url('cars_attributes/ajax.php') . '&makeId='; ?>' + make_id;
            var result = '';
            if(make_id != '') {
                $("#model").attr('disabled',false);
                $.ajax({
                    type: "POST",
                    url: url,
                    dataType: 'json',
                    success: function(data){
                        var length = data.length;
                        if(length > 0) {
                            result += '<option value="" selected><?php _e('Select a model', 'cars_attributes'); ?></option>';
                            for(key in data) {
                                result += '<option value="' + data[key].pk_i_id + '">' + data[key].s_name + '</option>';
                            }
                        } else {
                            result += '<option value=""><?php _e('No results', 'cars_attributes'); ?></option>';
                        }
                        $("#model").html(result);
                    }
                 });
             } else {
                result += '<option value="" selected><?php _e('Select a model', 'cars_attributes'); ?></option>';
                $("#model").attr('disabled',true);
                $("#model").html(result);
             }
        });
    });
</script>
</br>
<h2><?php _e('Car Details', 'cars_attributes') ; ?></h2>
<div>
    <div class="control-group">
        <?php
            if( Session::newInstance()->_getForm('pc_make') != '' ) {
                $detail['fk_i_make_id'] = Session::newInstance()->_getForm('pc_make');
            }
        ?>
        <label class="control-label"><?php _e('Make', 'cars_attributes'); ?></label>
        <div class="controls">
        <div class="select-box ">
        <select name="make" id="make" style="opacity: 0;">
        <option value="" selected><?php _e('Select a make...', 'cars_attributes'); ?></option>
        <?php foreach($makes as $a){ ?>
        <option value="<?php echo $a['pk_i_id']; ?>" <?php if(@$detail['fk_i_make_id'] == $a['pk_i_id']) { echo 'selected'; } ?>><?php echo $a['s_name']; ?></option>
        <?php } ?>  
        </select>
        <a href="#" class="select-box-trigger"><span class="select-box-label"></span><span class="select-box-icon">0</span></a>
        
        </div>
        </div>
    </div>
  <div class="control-group">
        <?php
            if( Session::newInstance()->_getForm('pc_model') != '' ) {
                $detail['fk_i_model_id'] = Session::newInstance()->_getForm('pc_model');
            }
        ?>
        <label class="control-label"><?php _e('Model', 'cars_attributes'); ?></label>
        <div class="controls">
        <div class="select-box ">
        <select name="model" id="model" style="opacity: 0;">
            <option value="" selected><?php _e('Select a model', 'cars_attributes'); ?></option>
            <?php foreach($models as $a) { ?>
            <option value="<?php echo $a['pk_i_id']; ?>" <?php if(@$detail['fk_i_model_id'] == $a['pk_i_id']) { echo 'selected'; } ?>><?php echo $a['s_name']; ?></option>
            <?php }?>
        </select>
        <a href="#" class="select-box-trigger"><span class="select-box-label"></span><span class="select-box-icon">0</span></a>
        
        </div>
        </div>
    </div>
    <div class="control-group">
        <?php $locales = osc_get_locales();
        if( Session::newInstance()->_getForm('pc_car_type') != '' ) {
            $detail['fk_vehicle_type_id'] = Session::newInstance()->_getForm('pc_car_type');
        }
        if(count($locales)==1) {
            $locale = $locales[0]; ?>
            <p>
                <label class="control-label"><?php _e('Car type', 'cars_attributes'); ?></label>
                <div class="controls">
                <div class="select-box ">
                <select name="car_type" id="car_type" >
                    <option value="" selected><?php _e('Select a car type', 'cars_attributes'); ?></option>
                    <?php foreach($car_types[$locale['pk_c_code']] as $k => $v) { ?>
                    <option value="<?php echo  $k; ?>" <?php if(@$detail['fk_vehicle_type_id'] == $k) { echo 'selected'; } ?>><?php echo @$v; ?></option>
                    <?php } ?>
                </select>
                <a href="#" class="select-box-trigger"><span class="select-box-icon">0</span></a>
                </div>
                </div>
            </p>
        <?php } else { ?>
            <div class="tabber">
            <?php foreach($locales as $locale) {?>
                <div class="tabbertab">
                    <h2><?php echo $locale['s_name']; ?></h2>
                    <p>
                        <label class="control-label"><?php _e('Car type', 'cars_attributes'); ?></label>
                        <div class="controls">
                        <div class="select-box ">
                        <select name="car_type" id="car_type" >
                            <option value="" selected><?php _e('Select a car type', 'cars_attributes'); ?></option>
                            <?php foreach($car_types[$locale['pk_c_code']] as $k => $v) { ?>
                            <option value="<?php echo  $k; ?>" <?php if(@$detail['fk_vehicle_type_id'] == $k) { echo 'selected'; } ?>><?php echo @$v; ?></option>
                            <?php } ?>
                        </select>
                        <a href="#" class="select-box-trigger"><span class="select-box-icon">0</span></a>
                        </div>
                        </div>
                    </p>
                </div>
            <?php } ?>
            </div>
        <?php } ?>
    </div>
    <div class="control-group">
        <?php
            if( Session::newInstance()->_getForm('pc_year') != '' ) {
                $detail['i_year'] = Session::newInstance()->_getForm('pc_year');
            }
        ?>
        <label class="control-label"><?php _e('Year', 'cars_attributes'); ?></label>
        <div class="controls">
        <input type="text" name="year" id="year" value="<?php echo @$detail['i_year']; ?>" size=4 />
        </div>
    </div>
    <div class="control-group">
        <?php
            if( Session::newInstance()->_getForm('pc_doors') != '' ) {
                $detail['i_doors'] = Session::newInstance()->_getForm('pc_doors');
            }
        ?>
        <label class="control-label"><?php _e('Doors', 'cars_attributes'); ?></label>
        <div class="controls">
        <div class="select-box ">
        <select name="doors" id="doors" >
		<option value=""><?php _e('Select num. of doors', 'cars_attributes'); ?></option>
        <?php foreach(range(3, 5) as $n) { ?>
            <option value="<?php echo $n; ?>" <?php if(@$detail['i_doors'] == $n) { echo 'selected'; } ?>><?php echo $n; ?></option>
        <?php } ?>
        </select>
        <a href="#" class="select-box-trigger"><span class="select-box-icon">0</span></a>
        </div>
        </div>
    </div>
    <div class="control-group">
        <?php
            if( Session::newInstance()->_getForm('pc_seats') != '' ) {
                $detail['i_seats'] = Session::newInstance()->_getForm('pc_seats');
            }
        ?>
        <label class="control-label"><?php _e('Seats', 'cars_attributes'); ?></label>
        <div class="controls">
        <div class="select-box ">
        <select name="seats" id="seats" >
		<option value=""><?php _e('Select num. of seats', 'cars_attributes'); ?></option>
            <?php foreach(range(1, 17) as $n) { ?>
            <option value="<?php echo $n; ?>" <?php if(@$detail['i_seats'] == $n) { echo 'selected'; } ?>><?php echo $n; ?></option>
            <?php } ?>
        </select>
        <a href="#" class="select-box-trigger"><span class="select-box-icon">0</span></a>
        </div>
        </div>
    </div>
    <div class="control-group">
        <?php
            if( Session::newInstance()->_getForm('pc_mileage') != '' ) {
                $detail['i_mileage'] = Session::newInstance()->_getForm('pc_mileage');
            }
        ?>
        <label class="control-label"><?php _e('Mileage', 'cars_attributes'); ?></label>
        <div class="controls">
        <input type="text" name="mileage" id="mileage" value="<?php echo @$detail['i_mileage']; ?>" />
        </div>
    </div>
    <div class="control-group">
        <?php
            if( Session::newInstance()->_getForm('pc_engine_size') != '' ) {
                $detail['i_engine_size'] = Session::newInstance()->_getForm('pc_engine_size');
            }
        ?>
        <label class="control-label"><?php _e('Engine size (cc)', 'cars_attributes'); ?></label>
        <div class="controls">
        <input type="text" name="engine_size" id="engine_size" value="<?php echo @$detail['i_engine_size']; ?>" />
        </div>
    </div>
    <div class="control-group>">
        <?php
            if( Session::newInstance()->_getForm('pc_num_airbags') != '' ) {
                $detail['i_num_airbags'] = Session::newInstance()->_getForm('pc_num_airbags');
            }
        ?>
        <label class="control-label"><?php _e('Num. Airbags', 'cars_attributes'); ?></label>
        <div class="controls">
        <div class="select-box ">
        <select name="num_airbags" id="num_airbags" >
			<option value=""><?php _e('Select num. of airbags', 'cars_attributes'); ?></option>
            <?php foreach(range(1,  as $n) { ?>
            <option value="<?php echo $n; ?>" <?php if(@$detail['i_num_airbags'] == $n) { echo 'selected'; } ?>><?php echo $n; ?></option>
            <?php } ?>
        </select>
        <a href="#" class="select-box-trigger"><span class="select-box-icon">0</span></a>
        </div>
        </div>
    </div>
    <div class="control-group">
        <?php
            if( Session::newInstance()->_getForm('pc_transmission') != '' ) {
                $detail['e_transmission'] = Session::newInstance()->_getForm('pc_transmission');
            }
        ?>
        <label class="control-label"><?php _e('Transmission', 'cars_attributes'); ?></label>
        <div class="controls">
        <div class="select-box ">
        <select name="transmission" id="transmission" >
            <option value="MANUAL" <?php if(@$detail['e_transmission'] == 'MANUAL') { echo 'selected'; } ?>><?php _e('Manual', 'cars_attributes'); ?></option>
            <option value="AUTO" <?php if(@$detail['e_transmission'] == 'AUTO') { echo 'selected'; } ?>><?php _e('Auto', 'cars_attributes'); ?></option>
        </select>
        <a href="#" class="select-box-trigger"><span class="select-box-icon">0</span></a>
        </div>
        </div>
    </div>
    <div class="control-group">
        <?php
            if( Session::newInstance()->_getForm('pc_fuel') != '' ) {
                $detail['e_fuel'] = Session::newInstance()->_getForm('pc_fuel');
            }
        ?>
        <label class="control-label"><?php _e('Fuel', 'cars_attributes'); ?></label>
        <div class="controls">
        <div class="select-box ">
        <select name="fuel" id="fuel" >
            <option value="DIESEL" <?php if(@$detail['e_fuel'] == 'DIESEL') { echo 'selected'; } ?>><?php _e('Diesel', 'cars_attributes'); ?></option>
            <option value="GASOLINE" <?php if(@$detail['e_fuel'] == 'GASOLINE') { echo 'selected'; } ?>><?php _e('Gasoline', 'cars_attributes'); ?></option>
            <option value="ELECTRIC-HIBRID" <?php if(@$detail['e_fuel'] == 'ELECTRIC-HIBRID') { echo 'selected'; } ?>><?php _e('Electric-hibrid', 'cars_attributes'); ?></option>
            <option value="OTHER" <?php if(@$detail['e_fuel'] == 'OTHER') { echo 'selected'; } ?>><?php _e('Other', 'cars_attributes'); ?></option>
        </select>
        <a href="#" class="select-box-trigger"><span class="select-box-icon">0</span></a>
        </div>
        </div>
    </div>
    <div class="control-group">
        <?php
            if( Session::newInstance()->_getForm('pc_seller') != '' ) {
                $detail['e_seller'] = Session::newInstance()->_getForm('pc_seller');
            }
        ?>
        <label class="control-label"><?php _e('Seller', 'cars_attributes'); ?></label>
        <div class="controls">
        <div class="select-box ">
        <select name="seller" id="seller" >
            <option value="DEALER" <?php if(@$detail['e_seller'] == 'DEALER') { echo 'selected'; } ?>><?php _e('Dealer', 'cars_attributes'); ?></option>
            <option value="OWNER" <?php if(@$detail['e_seller'] == 'OWNER') { echo 'selected'; } ?>><?php _e('Owner', 'cars_attributes'); ?></option>
        </select>
        <a href="#" class="select-box-trigger"><span class="select-box-icon">0</span></a>
        </div>
        </div>
    </div>
    <div class="control-group">
        <?php
            if( Session::newInstance()->_getForm('pc_warranty') != '' ) {
                $detail['b_warranty'] = Session::newInstance()->_getForm('pc_warranty');
            }
        ?>
        <label class="control-label"><?php _e('Warranty', 'cars_attributes'); ?></label>
        <div class="controls">
        <input type="checkbox" name="warranty" id="warranty" value="1" <?php if(@$detail['b_warranty'] == 1) { echo 'checked="yes"'; } ?> /> 
        </div>
    </div>
    <div class="control-group">
        <?php
            if( Session::newInstance()->_getForm('pc_new') != '' ) {
                $detail['b_new'] = Session::newInstance()->_getForm('pc_new');
            }
        ?>
        <label class="control-label"><?php _e('New', 'cars_attributes'); ?></label>
        <div class="controls">
        <input type="checkbox" name="new" id="new" value="1" <?php if(@$detail['b_new'] == 1) { echo 'checked="yes"'; } ?> /> 
        </div>
    </div>
    <div class="control-group">
        <?php
            if( Session::newInstance()->_getForm('pc_power_unit') != '' ) {
                $detail['e_power_unit'] = Session::newInstance()->_getForm('pc_power_unit');
            }
            if( Session::newInstance()->_getForm('pc_power') != '' ) {
                $detail['i_power'] = Session::newInstance()->_getForm('pc_power');
            }
        ?>
        <label class="control-label"><?php _e('Power', 'cars_attributes'); ?></label>
        <div class="controls">
        <input type="text" name="power" id="power" value="<?php echo @$detail['i_power']; ?>" />
        <div class="select-box ">
        <select name="power_unit" id="power_unit" >
            <option value="KW" <?php if(@$detail['e_power_unit'] == 'KW') { echo 'selected'; } ?>><?php _e('Kw', 'cars_attributes'); ?></option>
            <option value="CV" <?php if(@$detail['e_power_unit'] == 'CV') { echo 'selected'; } ?>><?php _e('Cv', 'cars_attributes'); ?></option>
            <option value="CH" <?php if(@$detail['e_power_unit'] == 'CH') { echo 'selected'; } ?>><?php _e('Ch', 'cars_attributes'); ?></option>
            <option value="KM" <?php if(@$detail['e_power_unit'] == 'KM') { echo 'selected'; } ?>><?php _e('Km', 'cars_attributes'); ?></option>
            <option value="HP" <?php if(@$detail['e_power_unit'] == 'HP') { echo 'selected'; } ?>><?php _e('Hp', 'cars_attributes'); ?></option>
            <option value="PS" <?php if(@$detail['e_power_unit'] == 'PS') { echo 'selected'; } ?>><?php _e('Ps', 'cars_attributes'); ?></option>
            <option value="PK" <?php if(@$detail['e_power_unit'] == 'PK') { echo 'selected'; } ?>><?php _e('Pk', 'cars_attributes'); ?></option>
            <option value="CP" <?php if(@$detail['e_power_unit'] == 'CP') { echo 'selected'; } ?>><?php _e('Cp', 'cars_attributes'); ?></option>
        </select>
        <a href="#" class="select-box-trigger"><span class="select-box-icon">0</span></a>
        </div>
        </div>
    </div>
    <div class="row auto">
        <?php if( Session::newInstance()->_getForm('pc_gears') != '' ) {
                $detail['i_gears'] = Session::newInstance()->_getForm('pc_gears');
            }
        ?>
        <label class="control-label"><?php _e('Gears', 'cars_attributes'); ?></label>
        <div class="controls">
        <div class="select-box ">
        <select name="gears" id="gears" >
		<option value=""><?php _e('Select num. of gears', 'cars_attributes'); ?></option>
        <?php foreach(range(1,  as $n) { ?>
            <option value="<?php echo $n; ?>" <?php if(@$detail['i_gears'] == $n) { echo 'selected'; } ?>><?php echo $n; ?></option>
        <?php } ?>
        </select>
        <a href="#" class="select-box-trigger"><span class="select-box-icon">0</span></a>
        </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    tabberAutomatic();
</script>

 

Over my head lol ... again .. Thank you so much for your time !!

Edited by CTK501

The code that generates the select dropdowns for Vehicles (inside the AJAX function $('#catID').change()...) should also generate the corresponding label for that dropdown, if you get me. Because as far as I can tell, the dropdowns are being generated with empty labels.

  • Author

Unfortunately i can't afford to pay a "Web Person" to do it for me, as this is a non profit project for my own fun. I have asked for help here and a couple of people have been really helpfull in trying to work out the problem. If it gets to much for them i fully understand and i will continue to appreciate the help which they have given me. Lyndsey has attempted to help me, and although her method did not work in this case, it was a great learning experience for me, for which i am greatly appreciative. This is an opensource cms which id did not build but i am trying to learn. I struggle to see how anyone on this forum could benefit from you jumping on a thread, suggesting payment and criticizing somebody elses work ... especially when it is an active thread that people are involved in solving ...

  • Author

Lyndsey thanks again for that, i can see what you mean, and i had assumed that it would work that way, but unfortunately it's not working. I guess i can afford to lose the styling and just remove the opacity .. then it will at least be functional, if not as aesthetically pleasing ... I really appreciate your help Lyndsey and i actually did learn something from your first suggestion.

 

Thanks again !!!

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.