0
Need help with my newsletter
hello, i wrote a code. But i cannot find what mistake i make.
2 odpowiedzi
0
<?php
mysql_connect("localhost", "root", "usbw");
mysql_select_db("emails");
"emails `INSTERT INTO `Nieuwsbrief` . `lijst` (`emails`) VALUES ($_POST);";
?>
<form class="inline-form" method="POST">
<input type="email" id="nlmail" name="emails" class="span8" placeholder="Enter your email" required />
<button id="subscribe" class="button button-sp">Subscribe</button>
</form>
0
The third line of code in the <?php ?> is a string litteral without any function call or variable affectation...
So it's contain your SQL query, wich isn't execute ( maybe silently, without any error message ), but not only, because you wrote :
>> "emails `INSTERT INTO `Nieuwsbrief` . `lijst` (`emails`) VALUES ($_POST);";
... and I think the query start with "INSERT INTO"; probably you wrote it from an example, and don't copy or adapt cleanly...
In times I wrote this post, I saw your mistake :
You should replace your php bloc by ( changes explain in comments )
<?php
mysql_connect("localhost", "root", "usbw"); // not verified
// initialization of var before its use
$emails = "INSTERT INTO `Nieuwsbrief` . `lijst` (`emails`) VALUES ($_POST);";
// ( I don't verify is your query is correct )
mysql_select_db($emails); // emails is a variable, not a litteral string
?>