Will this record all user information to selected database?
What I'm trying to do is record information from a contact form for a beta
sign up. I wanted to know that using the current code to record the
information would the value that i listed for $key write directly to the
MySQL database? or do I have to print the $key in some manner that the
user end cant view it so that it could be recorded?
I would have format the code all fancy but I'm new to Stack Overflow and
didn't know who to format it correctly but tried by best! Any information
you could provide me would be great thanks for taking time out of your day
to assist me.
$hostname = "localhost";
$username = "root";
$password = "passwordhere";
$database = "anonbeta"
$databasetable = "anon_betasignup";
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$emailaddress = $_POST['emailaddress'];
$key = md5(microtime().rand());
mysql_connect($hostname, $username, $password, $database)
or die ("Could not connect to MySQL Database");
mysql_query($hostname, $username, $password, anonbeta)
or die ("Could not connect to selected database");
INSERT INTO anon_betasignup (firstname, lastname, emailaddress, key)
VALUES ($firstname, $lastname, $emailaddress, $key);
mysql_close();
echo"Your connection to MySQL has been closed";
No comments:
Post a Comment