在php变量中添加一个额外的单词?

Here is part of something im trying to do, Where ive got the 2nd $course_item .= i want to add a word here so its actually like:

cerealchoices or toastchoices etc etc

How can i add the word choices to the end of the $course_item variable?

This is to loop through all the text boxes.

$course_menuname = $row['course_menuname']; #E.G breakfast_cereal, breakfast_toast
$course_item = $row['course_jsname']; #E.G cereal, toast, jacketpotato
if(!empty($course_menuname)) {
   foreach($course_menuname as $course_item) {
    $course_item = trim($course_item);
    if(!empty($course_item)) {
      $course_item .= "$course_item;";
    }
   }
 }

This is what i want it to look like:

$course_menuname = $row['course_menuname']; #E.G breakfast_cereal, breakfast_toast
$course_item = $row['course_jsname']; #E.G cereal, toast, jacketpotato
if(!empty($_POST['breakfast_cereal'])) {
   foreach($_POST['breakfast_cereal'] as $cereal) {
    $cereal= trim($cereal);
    if(!empty($cereal)) {
      $cerealchoices .= "$cereal;";
    }
   }
 }

Where it says cerealchoices, in the first one the variable $course_item has the word cereal i want to add the world choices to the end of it?

$course_item = "{$row['course_jsname']}choices";

Should do what you need. Note that the curly braces aren't actually printed, they just tell PHP to treat all of the contained text as a variable.

This should help you with your goal :)

$course_item = $row['course_jsname']."choices";

Although Philip Pryce has a more elegant solution :)

Read more in PHP manual