Jump to content

Bold Text in Textbox


elmas156

Recommended Posts

I have a text box for users to enter new text in.  The box also contains text that is determined by a variable that is created from a mysql query and some other added text.  I want to make a portion of the added text within the textbox bold.  How would I achieve this with php?

 


<?php

result = mysql_query("SELECT `something` FROM `table` WHERE `this` = '$that'");
row = mysql_fetch_row($result);
$variable = $row[0];

$text = "<strong>Here is the text that I want bold</strong>

$variable";

echo "<textarea name=\"textbox\">";
echo "$text";
echo "</textarea>

?>

Doing this gives me this result in the textbox:

"<strong>Here is the text that I want bold</strong>

This is what the variable text says."

 

Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/212974-bold-text-in-textbox/
Share on other sites

I have a text box for users to enter new text in.  The box also contains text that is determined by a variable that is created from a mysql query and some other added text.  I want to make a portion of the added text within the textbox bold.  How would I achieve this with php?

 


<?php

result = mysql_query("SELECT `something` FROM `table` WHERE `this` = '$that'"); // result or $result?
row = mysql_fetch_row($result);  // row or $row ?
$variable = $row[0];

$text = "<strong>Here is the text that I want bold</strong>  // missing " and ;

$variable";  // what ?

echo "<textarea name=\"textbox\">";
echo "$text";
echo "</textarea>  // missing " and ;

?>

Doing this gives me this result in the textbox:

"<strong>Here is the text that I want bold</strong>

This is what the variable text says."

 

Any ideas?

 

comments in your code ^^^

My fault for trying to type too fast.  The code that I have works fine... no errors or anything.  The code that I posted is just generic code to try to show what I'm trying to do.  I'm not using the same computer to post here as I am to write my code so copying and pasting the code would be out of the question... I'm just trying to find out how to make the text in the textbox bold.

 

Thanks for your reply.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.