View Full Version : enter value from form to database table

03-01-2010, 12:08 PM
in my php page , ther is a form for ntering email , shown below ..
whenever a user enters email , i need to add tat to my database table 'log_table'.

<tr><td>email</td><td><input type="text" id="email" name="email" value=""/></td></tr>

to add to table , i used the foll , query

ql_query("INSERT INTO log_table (email) VALUES ('$_POST['email]')");

but it doesnt work.. pls give me a solution ..

03-01-2010, 12:14 PM
What's ql_query() ?

03-01-2010, 04:30 PM
I think the code was cut off, it's suppose to be this.

mysql_query("INSERT INTO log_table (email) VALUES ('$_POST['email]')");

03-04-2010, 02:27 PM
make it simpler!

//do email validation here, remove any quotes
// from the email input or else expect sql injection attacks!

mysql_query("INSERT INTO log_table (email) VALUES ('$email')")