I’m able to read the data from my database but I’m unable to insert data into it.
<?php
//Submits responses into the database
include("db.php");
header( 'Location: /results.php' ) ;
$inform = $_POST['inform'];
$email = $_POST['email'];
$member = $_POST['member'];
$attending = $_POST['attend'];
$tour = $_POST['tour'];
$liketour = $_POST['liketour'];
$find = $_POST['find'];
$compare = $_POST['compare'];
$slength = $_POST['time'];
$vendors = $_POST['vendors'];
$experience = $_POST['experience'];
$stuservice = $_POST['students'];
$food = $_POST['food'];
$signs = $_POST['signs'];
$organization = $_POST['organization'];
$clean = $_POST['clean'];
$dj = $_POST['dj'];
$comem = $_POST['comm'];
$comments = $_POST['comments'];
$contact = $_POST['contacts'];
$phone = $_POST['phone'];
$query = "INSERT INTO survey
VALUES ('$inform', '$email', '$member', '$attending', '$tour', '$liketour', '$find', '$compare', '$slength', '$vendors', '$experience',
'$stuservice', '$food', '$signs', '$organization', '$clean', '$dj', '$comem', '$comments', '$contact', '$phone')";
mysql_query($query) or die(myql_error());
?>
There’s actually a field before the inform, the auto increment ID field.
Here’s the top of the form which I assume is correct, its been a while since I’ve done this.
<form action="survey.php" method="post">
Anyway, I’m not getting any errors what-so-ever. I’m also not getting any data what-so-ever.
I’m thinking that the header function might be running before the rest of the code? The header function doesn’t seem to work if I place it below the rest of the code, suggestions anyone?