-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathaskquery.php
77 lines (73 loc) · 2.19 KB
/
askquery.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
session_start();
if ( $_SESSION[ "sidx" ] == "" || $_SESSION[ "sidx" ] == NULL ) {
header( 'Location:studentlogin' );
}
$userid = $_SESSION[ "sidx" ];
$userfname = $_SESSION[ "fname" ];
$userlname = $_SESSION[ "lname" ];
?>
<?php include('studenthead.php'); ?>
<div class="container">
<div class="row">
<div class="col-md-12">
<h3> Welcome <a href="welcomestudent.php" <?php echo "<span style='color:red'>".$userfname." ".$userlname."</span>";?> </a></h3>
<?php
include('database.php');
$eid=$_GET['eid']; //get data form another page
?>
<div class="container">
<div class="row">
<div class="col-md-12">
<form action="" method="POST" name="update">
<fieldset>
<legend>Query Details</legend>
<table>
<td>
<h3>
<tr><strong>Email ID :</strong> </tr>
<tr>
<strong>
<?php echo $eid; ?>
</strong>
</tr>
</h3>
</td>
<table>
</table>
<td>
<tr><strong><h3>Query :</h3></strong> </tr><br <tr><textarea class="form-control" rows="10" cols="40" name="squeryx" class="form-control" required></textarea>
</tr>
</td>
</table>
<br>
<input type="submit" value="Post Query!" name="addq" class="btn btn-success">
</fieldset>
</form>
</div>
</div>
</div>
<?php
if ( isset( $_POST[ 'addq' ] ) ) {
//fetch data from table
$tempsquery = $_POST[ 'squeryx' ];
$tempseid = $eid;
$sql = "INSERT INTO `query`(`Query`, `Eid`) VALUES ('$tempsquery','$tempseid')";
if ( mysqli_query( $connect, $sql ) ) {
echo "<br>
<br><br>
<div class='alert alert-success fade in'>
<a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a>
<strong>Success!</strong> Your Query Added Successfully. Reff. No: " . mysqli_insert_id( $connect ) . "
</div>";
} else {
//error message if SQL query fails
echo "<br><Strong>Query Addeding Faliure. Try Again</strong><br> Error Details: " . $sql . "<br>" . mysqli_error( $connect );
}
//close the connection
mysqli_close( $connect );
}
?>
</div>
</div>
<?php include('allfoot.php'); ?>