You need to append a space to the value when assigning it. replace $data = $_POST['textdata']; by $data = $_POST['textdata'] . ' ';