...

View Full Version : enter value from form to database table



renu-86
03-01-2010, 01: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

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

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

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

masterofollies
03-01-2010, 05: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]')");

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


$email=$_POST['email'];
//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')")



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum