$query = mysql_query("INSERT INTO table (eventname, organiserid) VALUES ('" .$eventname."', '" .$organiserid."')");
table is probably a mysql reserved word - either quote it with
backticks, or better, give your table a better name such as events.
Also, check the value of mysql_error()
You are also missing some other simple techniques that will help you solve these kind of common "it doesnt work" errors:
- if organiserid is a number then typecast is as such, and there is no need to then quote it
- PHP variables which are not arrays will expand correctly when wrapped in double quotes "".
- Create a variable holding the sql statement so that you can echo it onto the screen, inspect what PHP is doing for you, and even then copy that directly into your database management tool to check it is valid
Example: (if indeed id is an integer)
// typecast id to an integer
$organiserid = (int)$_POST['id'];
// then build your query string
$newevent_sql = "INSERT INTO table (eventname, organiserid) VALUES ('$eventname', $organiserid)" ;
// a line of debug so you can check that worked as expected
// now send in your query
$query = mysql_query($newevent_sql);