Forum Moderators: coopster

Message Too Old, No Replies

Bizarre problem when trying to write to a csv file

         

compuv

5:57 pm on Aug 27, 2007 (gmt 0)

10+ Year Member



I'm obtaining a weird message when I try to add the capability to write to a csv file into the formmail script that I'm using. Everything is fine initially and the email comes through to me perfectly from the simple HTML form I've designed. However, when I add the path to the CSV directory into the appropriate section in the php script being called, I get the following when I run the script:

Parse error: parse error, unexpected ';' in /home/myaccount/public_html/suggest/Feedback.php on line 5439

The $CSVDIR section looks like this:

$CSVDIR = "/home/myaccount/public_html/csvdir";// directory for csv files; empty string to
// disallow csv files
$CSVSEP = ",";// comma separator between fields (columns)
$CSVINTSEP = ";";// semicolon is the separator for fields (columns)
// with multiple values (checkboxes, etc.)
$CSVQUOTE = '"';// all fields in the CSV are quoted with this character;
// default is double quote. You can change it to
// single quote or leave it empty for no quotes.
//$CSVQUOTE = "'";// use this if you want single quotes
$CSVOPEN = "";// set to "b" to force line terminations to be
// kept as $CSVLINE setting below, regardless of
// operating system. Keep as empty string and
// leave $CSVLINE unchanged, to get text file
// terminations for your server's operating system.
// (Line feed on UNIX, carriage-return line feed on Windows).
$CSVLINE = "\n";// line termination for CSV files. The default is
// a single line feed, which may be modified for your
// server's operating system. If you want to change
// this value, you *must* set $CSVOPEN = "b".

The section giving the error looks like this with the "if" part being Line 5439:

{
global$TARGET_URLS;

foreach ($TARGET_URLS as $s_prefix)
if (!empty($s_prefix) &&
strtolower(substr($s_url,0,strlen($s_prefix))) ==
strtolower($s_prefix))
return (true);
return (false);
}

I don't know what's wrong with this. More bizarrely, when I remove this CSV modification and revert to the original script, this error stays! I'm not a programmer so I'm a bit stuck here. I'm just trying to use the script as an "out-of-the-box" solution.

Any help greatly appreciated.

Dave

d40sithui

6:12 pm on Aug 27, 2007 (gmt 0)

10+ Year Member



i wonder how u got that there.

if (!empty($s_prefix) &&

& is an html entity ampersand(&).
change that line to

if (!empty($s_prefix)){