Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.