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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:35:01+00:00 2026-05-26T20:35:01+00:00

Many instances when I have html like this, i follow it with jquery to

  • 0

Many instances when I have html like this, i follow it with jquery to set the value. However I feel this is not the best way to do it and was looking for alternatives.

 <select class='papertype' name='papertype'>
      <option value='glossy'>Glossy</option>
      <option value='matte'>Matte</option>
      <option value='luster'>Luster</option>
      <option value='metallic'>Metallic</option>
 </select>

$(document).ready(function(){
    $('.papertype').val('<?php print $image->paper_type; ?>');
}

Im hoping to do this without using any type of javascript, completely server side. An important factor thats causing the problem is that the page I am coding right now has multiple instances of .papertype, all of which will have different values. Thanks for any help!

  • 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-26T20:35:01+00:00Added an answer on May 26, 2026 at 8:35 pm
     <select class='papertype' name='papertype'>
          <option value='glossy' <?php echo ($image->paper_type == 'glossy' ? ' selected="selected"' : ''); ?>>Glossy</option>
          <option value='matte' <?php echo ($image->paper_type == 'matte' ? ' selected="selected"' : ''); ?>>Matte</option>
          <option value='luster' <?php echo ($image->paper_type == 'luster' ? ' selected="selected"' : ''); ?>>Luster</option>
          <option value='metallic' <?php echo ($image->paper_type == 'metallic' ? ' selected="selected"' : ''); ?>>Metallic</option>
     </select>
    

    Of course, you can do that in a more elegant way on a higher abstraction level with arrays etc., but you get the idea.

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

Sidebar

Related Questions

I have a class that I can have many instances of. Inside it creates
I have only one class with many instances. Every instance is observer of couple
We have an ASP.NET web application hosted by a web farm of many instances
I have similar instances of the same web application running across many domains. I
There are many instances where we are not happy with the decisions that Oracle's
I have many html forms referring to many persistence classes. All the html forms
I have a widget-like block of HTML+JavaScript that people can copy/paste into their HTML-page
I want to check how many instances of the letter a appears in a
I have a couple of simple objects that have a many-to-many relationship. Django has
I have code that looks like follows: public interface BaseDAO{ // marker interface }

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.