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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T13:28:54+00:00 2026-06-08T13:28:54+00:00

I am creating a category list.. 20 different categories and when they click and

  • 0

I am creating a category list.. 20 different categories and when they click and send a category it will pass a numeric value representing the category to the Database..

For example:

<option value="1">Apple</option>
<option value="2">Microsoft</option>

The reason for that I am passing a numeric value in the database, is because I have more than 1 language on the webpage, and I have different label files. I would like to echo a php variable based on the category number.

<? echo $ct_1; ?>

But to avoid a lot of if/else statements, I would like to know if I could add the number to the variable. So if I am looping the category to be this: $row['category'] I would like to add that variable to the other one.. Like so:

<? $category = $.'ct_'.$row['category']; echo $category; ?>

I know that is not possible.. But I hope you get my idea and maybe have a solution for this.

  • 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-06-08T13:28:56+00:00Added an answer on June 8, 2026 at 1:28 pm

    This is called variable variables.

    $category = ${'ct_'.$row['category']};
    echo $category;
    

    Or just:

    echo ${'ct_'.$row['category']};
    

         

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

Sidebar

Related Questions

I have one model User and will be creating another one Category . Both
I am creating a Category model and using the awesome_nested_set plugin (a replacement for
I'm creating an Objective-C category on the UIViewController class. In my project, I want
I am creating a Core Data application where: category entity has the following attributes
I'm creating aggregations and setting a filter in the advanced section. eg: x.category ==
I want to automate the process of creating a forum category with the phpBB
I have two models store and category . A store can have many categories
I would like to add functions by creating a category for Objective-C Blocks. __block
My question is a simple fundamental question for creating a subcategory of a category
I have an object that has a few different List properties that contain child

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.