Page 1 of 1

enter value from form to database table..

Posted: Mon Mar 01, 2010 6:10 am
by rrn
in my php page , there is a form for entering email , shown below ..
whenever a user enters email , i need to add tat to my database table 'log_table'.

Code: Select all

<tr><td>email</td><td><input type="text" id="email" name="email" value=""/></td></tr>
to add to table , i used the following query

Code: Select all

sql_query("INSERT INTO log_table (email) VALUES ('$_POST['email]')");
 
but it doesnt work.. pls give me a solution ..

Re: enter value from form to database table..

Posted: Mon Mar 01, 2010 12:13 pm
by jraede
What type of SQL database are you using?

Re: enter value from form to database table..

Posted: Mon Mar 01, 2010 12:36 pm
by Kurby
What part doesn't work? Does it give an error message? What happens? Is your form set to POST and posting to the right form?

Re: enter value from form to database table..

Posted: Mon Mar 01, 2010 12:42 pm
by lshaw
Is sql_query a function?

do you mean mysql_query (for mysql) or mssql_query(for microsoft sql)