I have a HTML form with the following:
<form method="POST" action="/subscribe/subscribe.php">
<p><input type="text" name "Email" value="[email protected]" onfocus="if(!this._haschanged){this.value=''};this._haschanged=true;"></p>
<p><input type="submit" value="Submit" name="Submit"></p>
</form>
I have the subscribe.php
file with the following code:
# CONTENT
$email = $_POST['Email'];
# SAVE A COPY
$mailcopyfile = 'mailcopyfile.txt';
$fp = fopen($mailcopyfile, "a");
fputs($fp, $now . $email . ", ");
fclose($fp);
But in my mailcopyfile.txt all I get is commas for every new form submission like:
, , , , ,
What am I doing wrong? Why doesn't the emails show?
There is an error in your form/input line:
<p><input type="text" name "Email" value="[email protected]" onfocus="if(!this._haschanged){this.value=''};this._haschanged=true;"></p>
after the name parameter is no equal sign. So i think this is the problem why there is no value in your text file.
<p><input type="text" name="Email" value="[email protected]" onfocus="if(!this._haschanged){this.value=''};this._haschanged=true;"></p>