$_sessions
I moved the session_start(); up to the top of the script and all my error messages went away except that the script wont connect to the database. I can connect to the database if I comment out session_start(); I read that there is a problem with PHP 4.2.2 and sessions. Maybe there is another way for me to accomplish what I am doing or a way to use sessions that will work correctly. I also need to make sure that all of my syntax works with php4.2.2. I noticed that session_register needs registered globals on. So I need to use $_SESSION instead.
Can anyone help?
Here is part of my code.
// Clean and trim the POSTed values MAY not need this or may have to do this another way
<PHP>foreach($POST as $varname => $value)
$SESSION["pageFormVars"]["{$varname}"] = trim(clean($value, 50));</PHP>
// Validate pgtitle
<PHP>if (empty($_SESSION["pageFormVars"]["pgtitle"]))
// The pgtitle for the home page cannot be NULL
$errorString .= "\n<br>The pgtitle field cannot be blank.";</PHP>
// Connection
// If we made it here, then the data is valid
<PHP>if (!($connection = @ mysql_pconnect($hostName,
$username,
$password)))
die("Could not connect to the database");
if (!mysql_select_db($databaseName, $connection))
showerror();
// Check to see if the pageid is in the database
if ($result = @ mysql_query ("SELECT pageid FROM pages, pgcontact, pgmission
WHERE pageid = $pageid", $connection))</PHP>
<PHP>INSERT INTO pages VALUES
'{$SESSION["pageFormVars"]["pgdesc"]}',
'{$SESSION["pageFormVars"]["pgname"]}',
'{$SESSION["pageFormVars"]["kywd1"]}',
'{$SESSION["pageFormVars"]["kywd2"]}',
'{$SESSION["pageFormVars"]["kywd3"]}',
'{$SESSION["pageFormVars"]["kywd4"]}',
'{$SESSION["pageFormVars"]["kywd5"]}',
'{$SESSION["pageFormVars"]["kywd6"]}',
'{$SESSION["pageFormVars"]["kywd7"]}',
'{$SESSION["pageFormVars"]["kywd8"]}',
'{$SESSION["pageFormVars"]["kywd9"]}',
'{$SESSION["pageFormVars"]["kywd10"]}',
'{$SESSION["pageFormVars"]["kywd11"]}',
'{$SESSION["pageFormVars"]["kywd12"]}',
'{$SESSION["pageFormVars"]["heading"]}',
'{$SESSION["pageFormVars"]["subheading"]}',
'{$SESSION["pageFormVars"]["paragraph1"]}',
'{$SESSION["pageFormVars"]["paragraph2"]}',
'{$SESSION["pageFormVars"]["paragraph3"]}',
'{$SESSION["pageFormVars"]["paragraph4"]}',
'{$SESSION["pageFormVars"]["picturetext1"]}',
'{$SESSION["pageFormVars"]["picturetext2"]}')", $connection)))</PHP>