Php javascript error message

Dear All,
I have text input such as below. What I want is that when I press submit button if the Item Name is empty then I want the error text in red shown beside the text input. I am using php how can I achieve it? Thank you.

<td width="90%">
			  <input class="text" size=5 id="itemName" name="itemName" value=""> 
			  <script>document.getElementById(itemName).focus()</script>			  
</td>

if (!isset($_POST['itemName']) || $_POST['itemName'] == '') {
  // echo the error message
}