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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:28:39+00:00 2026-06-11T13:28:39+00:00

i have variables $CV1 , $CV2 , $CV3 … How to get the values

  • 0

i have variables $CV1, $CV2, $CV3 … How to get the values of these variable inside while loop in PHP? Below is my code

$CV1=$fetch->Custom_field1;
$CV2=$fetch->Custom_field2;
$CV3=$fetch->Custom_field3;
$CV4=$fetch->Custom_field4;
$query=mysql_query("select * from customfields where CustomField like '%Invoice%' and CustomLabel != ''");
while($get=mysql_fetch_object($query))
        {
            $i++;
            $Label=$get->CustomLabel;
            $CFV='$CV'.$i;
            echo "<tr><td>$Label</td><td><input type='text' name='custom_field$i' value='$CFV'></td></tr>";
        }

but instead of getting the value of $CV1, $CV2. I’m getting the variable name itself as output. $CV1, $CV2, etc.

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

    You can use:

    $CFV = ${'CV'.$i};
    

    See Codepad Example

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

Sidebar

Related Questions

in c/c++, you have variables in stack when you create a local variable inside
I have variables with values like 1.7m 1.8k and 1.2b how can I convert
I have these variables: boost::regex re //regular expression to use std::string stringToChange //replace this
I have some variables inside a template and I don't know where I assigned
I have variables like this: var a = a variable; var b = test;
I have variables holding the translated labels for buttons inside a jquery ui dialog.
So I have a variable: PROGS = element0 \ element1 I have variables for
I have variables Student1, Student2, Student3 and Student I assign values to Student1, Student2
I have a data frame with an two Id variables and a name variable.
Just a quick query really, In my PHP file, I have variables coming from

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.