-
Notifications
You must be signed in to change notification settings - Fork 3
/
add_fdetails.php
executable file
·52 lines (49 loc) · 2.12 KB
/
add_fdetails.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
<?php
session_start();
include 'header.php';
include_once 'db.php';
$res=mysqli_query($conn,"select uid,name,email,phone from registeration where uid=".$_SESSION['user']);
$userRow=mysqli_fetch_array($res);
if(isset($_POST['send_request']))
{
$uid=$_POST['uid'];
$uname = mysqli_real_escape_string($conn,$_POST['username']);
$email = mysqli_real_escape_string($conn,$_POST['email']);
$phone=mysqli_real_escape_string($conn,$_POST['phone']);
$address=mysqli_real_escape_string($conn,$_POST['address']);
$food=mysqli_reali_escape_string($conn,$_POST['food']);
if(mysqli_query($conn,"INSERT INTO food_details(uid,name,email,phone,address,av_food) VALUES('$uid','$uname','$email','$phone','$address','$food')"))
{
?>
<script>alert('successfully registered ');</script>
<?php
header("location:add_fdetails.php");
}
else
{
?>
<script>alert('error while registering you...');</script>
<?php
}
}
?>
<html>
<head>
<link href="style.css" rel="stylesheet">
</head>
<body id="back" style="width: 100%; height:100%; padding-bottom:20px">
<div style="margin-left: 200px;">
<div id="divback">
<div id="divhead">Donate Food</div>
<form method="POST">
<div id="divfood">
<input type="hidden" name="uid" value="<?php echo $userRow['uid'];?>"><br>
<label>Username </label><input type="text" name="username" value="<?php echo $userRow['name'];?>"><br><br>
<label>Email </label><input type="email" name="email" value="<?php echo $userRow['email'];?>"><br><br>
<label>Phone </label><input type="text" name="phone" value="<?php echo $userRow['phone'];?>"><br><br>
<label>Address </label><input type="text" name="address"><br><br>
<label>Food Quantity </label><input type="text" name="food"><br><br></div> <div id="fooddiv"><input type="submit" name="send_request" Value="Send Request"></div>
</form>
</div></div>
</body>
</html>