I have a single field post of the form:
<form action="post.php" method="post">
<input type="text" name="foo" />
I am trying to insert foo
into a small mySql table named 'datatable'
in the database 'mydatabase'
in post.php.
This string works for me to add a data row in my table:
mysql_query('INSERT INTO 'mydatabase'.'datatable' ('data') VALUES (\'testabc\');');
So I know my connection string is working. However, I cannot figure out how to insert the actual post data ($_POST['foo'])
into my table. I have tried strings such as:
mysql_query('INSERT INTO 'mydatabase'.'datatable' ('data') VALUES (\'' + $_POST['foo'] + '\');');
But cannot figure out the correct syntax to make this work. Can any of you brilliant minds help hint me in the right direction?
Many thanks...