On forms.php: <form action="/sendforms.php" method="post" > <b>Message:</b><br><textarea rows="4" cols="30" name="message"></textarea><br> <input type="text" name="1" value="1"><br> <input type="text" name="2" value="2"><br> <input type="text" name="3" value="3"><br> <input type="text" name="4" value="4"><br> <input type="submit" value="Submit your comments"> </form> PHP: On sendforms.php: <?php $connect = mysql_connect("localhost","root","password"); mysql_select_db(form) or die(mysql_error()); $message = $_POST['message']; $1= $_POST['1']; $2 = $_POST['2']; $3 = $_POST['3']; $4 = $_POST['4']; $ip = getenv("REMOTE_ADDR"); $query = mysql_query("INSERT INTO `formtable` (`message`, `1`, `2`, `3`, `4`) VALUES('$message', '$1', '$2', '$3', '$4')"); echo "<META HTTP-EQUIV='REFRESH' CONTENT='5;URL=javascript:history.go(-1)'> You've sent a form, and will be redirected to the page where you submitted the forms. "; ?> PHP: Can't get it submitting into my database, any ideas?
try using letters for the variables $one, $two, $three and $four Also set the query as a variable $qry = "INSERT INTO `formtable` (`message`, `1`, `2`, `3`, `4`) VALUES('$message', '$1', '$2', '$3', '$4')");echo "<META HTTP-EQUIV='REFRESH' CONTENT='5;URL=javascript:history.go(-1)'> You've sent a form, and will be redirected to the page where you submitted the forms."; echo $qry; $query = mysql_query($qry); You can then run the query via PHPMYAdmin which will give you better error reporting.