elmas156 Posted September 9, 2010 Share Posted September 9, 2010 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? Quote Link to comment https://forums.phpfreaks.com/topic/212974-bold-text-in-textbox/ Share on other sites More sharing options...
mikosiko Posted September 9, 2010 Share Posted September 9, 2010 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 ^^^ Quote Link to comment https://forums.phpfreaks.com/topic/212974-bold-text-in-textbox/#findComment-1109240 Share on other sites More sharing options...
fortnox007 Posted September 9, 2010 Share Posted September 9, 2010 Your coding is far from correct. Start a variable with $ if you want to assign a value use = there is no need vor a variable to place it between double quotes if your only echo-ing the variable. Quote Link to comment https://forums.phpfreaks.com/topic/212974-bold-text-in-textbox/#findComment-1109243 Share on other sites More sharing options...
elmas156 Posted September 9, 2010 Author Share Posted September 9, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/212974-bold-text-in-textbox/#findComment-1109246 Share on other sites More sharing options...
The Eagle Posted September 9, 2010 Share Posted September 9, 2010 While I am unsure if this is capable with PHP, CSS is your answer for this. input { font-weight: bold; } Will bolden the text in that form input. Quote Link to comment https://forums.phpfreaks.com/topic/212974-bold-text-in-textbox/#findComment-1109248 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.