PHP text table save error
I was trying to build a small email subscriber system and I got some help from people and now I did, but I am having problems.
Here v in the code I have made hidden name input and email visible input, so whenever anyone sends it, it looks like Email @ email.com which would be better off copying everything and sending emails - anyway. This one works 100% on my localhost, but I tried uploading it to a domain and try it - it goes to the php page and shows me a warning, but there is no .txt file or any txt.
Here is the code: http://pastebin.com/1uE82mZQ
source to share
<?php
$ftp_server = "ftp.example.com"; //Sample ftp server
$ftp_user = "foo"; //Sample user
$ftp_pass = "bar"; //Sample pass
// set up a connection or die
$conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server");
// try to login
if (@ftp_login($conn_id, $ftp_user, $ftp_pass)) {
echo "Connected";
} else {
echo "Couldn't connect";
}
$NewsletterName = $_POST['NewsletterName'];
$NewsletterEmail = $_POST['NewsletterEmail'];
$done=fopen('subscribers.txt','w+');
fwrite($done, $NewsletterName . ',' . $NewsletterEmail);
echo '<script language="javascript">';
echo 'alert("Email has been successfully saved!")';
echo '</script>';
fclose($done);
ftp_close($conn_id);
?>
This is the basic structure !!! You need to make some changes !!! like $ftp_server
$ftp_user
and$ftp_pass
source to share