Been trying for hours anyways this form suppose to take my email that is being displayed and on submit inserts the details include email into database.
Instead of taking my 'email' it is taking my user id(auto increment) from user table and update that into feedback table.
feedback.php
<?php
$email =(isset($_SESSION['email']) ? $_SESSION['email'] : null);
$name='';$feedback=''; $topic=''; $details='';
$action =(isset($_POST['submit']) ? $_POST['submit'] : null);
if($action!=null) {
$name =(isset($_POST['name']) ? $_POST['name'] : null);
$feedback =(isset($_POST['feedback']) ? $_POST['feedback'] : null);
$topic =(isset($_POST['topic']) ? $_POST['topic'] : null);
$details =(isset($_POST['details']) ? $_POST['details'] : null)
if($details==null) {
echo "<br><p style='text-align:center;color:red'>Please fill up all text fields!</p>";
}
else {
$query="insert into feedback values('','$email','$name','$feedback','$topic','$details','',null)";
$result=mysql_query($query);
echo "<br><p style='text-align:center;color:blue'>Successfully submit the feedback to system </p>";
$feedback=''; $topic=''; $details='';
}
if( mysql_error()!="") {
echo "<font style='text-align:center;color:red'>" . mysql_error() . "</font><br>";
}
}
?>
<form method="post" action="user_feedback.php">
<?php
$email =(isset($_SESSION['email']) ? $_SESSION['email'] : null);
$query="select * from user where id=$email";
$result=mysql_query($query);
$row = mysql_fetch_array($result);
?>
<br>
<table cellpadding="5">
<tr><td style="width:150px">User Email</td><td><input type="text" name="email" value="<?php echo $row['email'] ?>" disabled style="width:200px;" ></td></tr>
<tr><td>User Name</td><td><input type="text" name="name" value="<?php echo $name ?>" style="width:300px;" ></td></tr>
<tr><td>Feedback</td>
<td>
<select name="feedback" style="height:32px">
<option <?php if($feedback=="Inquiry") { echo 'selected'; } ?> >Inquiry</option>
</select>
</td>
</tr>
<tr><td>Feedback Topic</td><td><input type="text" name="topic" value="<?php echo $topic ?>" style="width:300px;" ></td></tr>
<tr><td>Feedback Details</td><td><textarea type="comment" name="details" value="<?php echo $details ?>" style="width:500px;" ></textarea></td></tr>
<tr><td></td><td><input type="submit" name="submit" value="Submit" class="tall"></td></tr>
</table>
</form>