PHP Form can't find file

Hi everyone,

I’m working on installing a form on a site I’m building.

The interesting thing is; I have an exact copy of the form on my own site, but on the new one it’s not working.

Here’s the one on my site: http://www.zerflin.com/labs/contact.html

Here’s the one I’m working on: http://prayforfrance.org/register

Any ideas on why it won’t work? I’m stumped…

Is this a form you downloaded, if so first check with the author.

If not things that can and will cause problems under the correct conditions:

If short hand is used to open php tags. <? instead of <?php. As this is a setting in the php.ini file these can differ from server to server.

Global Variables - This too is a php.ini setting and can cause problems. Having global variables on in the php.ini file is not only a security risk, but allows for lazy coding. if(isset($start)) should be something like if(isset($_POST[‘start’]))

You can also try error_reporting(“E_ALL”) at the top of the page as on some servers they are considered production and don’t allow errors to show by default. Another php.ini setting.

Here, I’ve rewritten it to make it simpler:

http://ccfof.org/prayforfrance/contact/

The index.php code is below:

[code]

Name

Email

Whatcha wanna say?

[/code]

Here’s the contact.php code:

[code]

<? // Takes posts from form and turns it into an array $fields = $_POST; // Makes the submit button usable again, incase the form gets stuck unset($fields['submit']); // Sets the filename of the DSV file $file = "contact.csv"; // Opens the file (or error if it can't open it) $fh = fopen($file,'a') or die("can't open file"); // Puts a quote around the commas so that they turn into columns $delim = '","'; // Writes the commas from the line above $csv_row = implode($delim, $fields); // Puts a quote in front of the beginning of the first field fwrite($fh, '"'); // Writes the data from the line above fwrite($fh, $csv_row); // Puts a quote at the end of the last field fwrite($fh, '"'); // Sets up "Carriage Return Line Feed" (CRLF) (basically ENTER) or in HTML,
$crlf="rn"; // Writes the line above fwrite($fh, $crlf); // Closes the file fclose($fh); PRINT "

"; echo " Thank you! "; $message .= "nName: $namern nEmail: $emailrn nComment: $commentrn "; $headers .= "From: $email rn"; mail("[email protected]", "Zerflin Contact Form", $message, $headers); ?>

[/code]

Does that make sense?
What am I doing wrong?

Sponsor our Newsletter | Privacy Policy | Terms of Service