Tough question to ask, but basically I have a web form with a "title", "message" and "image" boxes, they all work in uploading it to one table on mysql.
What I want to do is have another field in my form for WHERE i want it to post to, I have 2 pages and 2 tables at the moment. table Blog and table Blog_2 They both work if I change my insert.php to INSERT INTO Blog or Blog_2
But i want to be able to use the field and a $_POST[Blog]
function which is linked to a field in a form, it's going to have a dropdown box to select either Blog or Blog_2
Below is my code. I've given it a go, but I cant seem to make it work. I created a variable called $insert as you can see.
Maybe its just a syntax problem, but im not that PHP savvy.
<?php
$con = mysql_connect("xxx","xxx","xxx");
mysql_select_db("databse") or die(mysql_error());
$insert = '$_POST[Blog]';
mysql_query("INSERT INTO $insert
(Date, Title, Message, Image)
VALUES(now(), '$_POST[Title]' , '$_POST[Message]' , '$_POST[Image]' ) ")
or die(mysql_error());
echo "1 record added";
mysql_close($con);
?>