Control Parallel LCD Through PHP

Here's the code I ended up using to solve my issue. Hopefully others will find it useful. Using a PHP script I can prefix my text string with certain characters that essentially control the cursor position. In this case, a string that starts with "!" sets the cursor on the first line. "@" sets the cursor on the second line, and "^" clears the screen.

#include <LiquidCrystal.h>
#include <WString.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(2, 3, 4, 9, 10, 11, 12);

void setup(){
  analogWrite(5, 100); // Set LCD contrast level (0-255)
  lcd.begin(16, 2); // Set the LCD's number of rows and columns
  
  Serial.begin(9600); // Initialize communication with serial(USB) port.
  lcd.print("Welcome."); // Print welcome message to LCD.
}

int bufferArray[250];
int output = 0;
int i = 0;

void loop() {
  int count = Serial.available();

  if (Serial.available() > -1)  {
    delay(1000);
    for (i=0; i<count; i++) {      
     bufferArray[i] = Serial.read();
     output = 1;                      
    } 
  }
  
  if (output != 0) {                      // if new bytes have been recieved                
    int position = 0;
    
    
    if (bufferArray[0] == '!') {         // Print on first line if message begins with !
      lcd.clear();
      lcd.setCursor(0,0);
      position = 1;
    } else if (bufferArray[0] == '@') {  // Print on second line if message begins with @
      lcd.setCursor(0,1);
      position = 1;
    } else if (bufferArray[0] == '^') {  // Clears the display
      lcd.clear();
      lcd.setCursor(0,0);
      position = 1;
    } else {
      lcd.clear();
      lcd.setCursor(0,0);
    }
    int j;
    for (j = position; j < count; j++) {
      lcd.write(bufferArray[j]);
    }
    output = 0;                
    memset(bufferArray, 0, count);
    count = 0;
  }
}