Jump to content

PHP script not working in FF, fine in IE- Apache


Mick7676

Recommended Posts

Sorry firt time here dont know where to post this..

I was wondering if anyone could tell me why this code would not work in FF

<?php

$email = $_POST['email'] ;

$name = $_POST['name'] ;

$surname = $_POST['surname'] ;

$city = $_POST['city'] ;

$File = "names.txt";

$Handle = fopen($File, 'a');

fwrite($Handle, $email);

fwrite($Handle, " ");

fwrite($Handle, $name);

fwrite($Handle, " ");

fwrite($Handle, $surname);

fwrite($Handle, " ");

fwrite($Handle, $city);

print "Data Added";

fclose($Handle);

?>

Thanks Mick

<?php
$name	=	$_POST['name'];
$email	=	$_POST['email'];
$surn	=	$_POST['surname'];
$city	=	$_POST['city'];
$file	=	'names.txt';
$handle = fopen($file, 'a');
$write_to_file = $email.' '.$name.' '.$surname.' '.$city.'<br>';
if( !fwrite($handle, $write_to_file) )
{
echo 'Error occured while writing to file.';
}
else if( fwrite($handle, $write_to_file) )
{
echo 'Data Added';
}
fclose($handle);
?>

 

Try that and if not try this:

 

<?php
$name	=	$_POST['name'];
$email	=	$_POST['email'];
$surn	=	$_POST['surname'];
$city	=	$_POST['city'];
$file	=	'names.txt';
$handle = fopen($file, 'a');
$write_to_file = $email.' '.$name.' '.$surname.' '.$city.'<br>';
fwrite($handle, $write_to_file)
echo 'Data Added';
fclose($handle);
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.