Here is the code snipet. Good news it has something to do with the variable it is getting from javascript because I removed the javascript prompt box and assigned the variable a value of TESTTALE and it worked so it has something to do with assigning the Javascript variable to php. I printed the variable in brackets and I do not see white spaces.
// Prompt user for TableSpace name then assign this to a php variable
print "<SCRIPT language='JavaScript'>";
print "var tablespace=window.prompt('Enter your desired MAROT Tablespace', '$strMarotTablespace')";
print "</SCRIPT>";
$strTablespace = "<SCRIPT language='JavaScript'>document.write(tablespace);</script>";
// MAXIMO Creatmax.sql stored in an array
$sql = array("grant connect, resource, DBA to ADMIN identified by ADMIN",
"grant connect to SQLADMIN identified by SQLADMIN",
"grant connect to PORT identified by PORT",
"alter user ADMIN default tablespace $strTablespace",
"alter user SQLADMIN default tablespace $strTablespace",
"alter user PORT default tablespace $strTablespace",
"grant connect, resource to marot identified by marot",
"grant DBA to marot",
"revoke unlimited tablespace from marot",
"alter user marot default tablespace $strTablespace quota unlimited on $strTablespace",
"alter user marot temporary tablespace temp",
"grant create public synonym to marot",
"grant drop public synonym to marot",
"grant create user to marot",
"grant drop user to marot");
// Cycle through array and run each sql statement
foreach ($sql as $key => $val)
{
print $val;
print "<br>";
$sql_statement = OCIParse($conn, $val);
//or die("Couldn't parse statement.");
OCIExecute($sql_statement);
//or die("Couldn't execute statement");
}