I am trying to create a WYSIWYG editor in PHP. So far I got this (I'm new btw):
HTML:
<form action="" method="POST">
<select name="fontSize" onchange="this.form.submit();">
<option>Font Size</option>
<option value="14px">14px</option>
<option value="24px">24px</option>
<option value="34px">34px</option>
</select>
</form>
<form action="" method="POST">
<textarea name="bodyText" style="width:500px;height:200px;font-size:<?php echo $fontSize; ?>"></textarea>
</form>
PHP:
<?php
$fontSize = $_POST['fontSize'];
switch($fontSize)
{
case "14px":
$fontSize = "14px";
break;
case "24px":
$fontSize = "24px";
break;
case "34px":
$fontSize = "34px";
break;
default:
$fontSize = "12px";
}
?>
The problem is when I select a new font size from the drop down menu the font size for the entire text area changes, instead I want to be able to highlight a particular word or letter and only have the font size of that change and not of the entire text area. How to go about this?