-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_post.php
53 lines (53 loc) · 2.87 KB
/
update_post.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
<!--
Update post form genertor
Description: Php script to produce the form to Update posts present in the db.
Author:Kshithij Iyer
Date: 11/9/2017
Email: ahole@disroot.org
-->
<?php
include_once("db_connection.php");
#connection object
$connection=mysqli_connect($host,$username,$password,$db_name);
#select query
$query="SELECT * FROM ".$table_prefix."post WHERE postid=".$_POST["postid"][0].";";
$result=mysqli_query($connection,$query);
if(mysqli_num_rows($result)>0){
while($row=mysqli_fetch_assoc($result)){
#generating a form
echo "<form method='post' action='update_post_entry.php'>";
echo "<input type='hidden' name='postid' id='postid' value=\"".$_POST["postid"][0]."\">";
echo "<table>";
echo "<tr><td><img src='./images/".$row["file_name"]."' style='width:300px;height:300px;'></td></tr>";
echo "<tr><td>caption</td><td><input type='text' class='textbox' id='caption' name='caption' value=\"".$row["caption"]."\"></td></tr>";
echo "<tr><td>hashtags</td><td><input type='text' class='textbox' id='hashtags' name='hashtags' value=\"".$row["hashtags"]."\"></td></tr>";
echo "<tr><td>Shutter Speed</td><td><input type='text' class='textbox' id='SS' name='SS' value=".$row["shutter_speed"]."></td></tr>";
echo "<tr><td>ISO</td><td><input type='text' class='textbox' id='ISO' name='ISO' value=".$row["iso"]."></td></tr>";
echo "<tr><td>Lattitude</td><td><input type='text' class='textbox' id='lat' name='lat' value=".$row["latitude"]."></td></tr>";
echo "<tr><td>Longitude</td><td><input type='text' class='textbox' id='longi' name='longi' value=".$row["longitude"]."></td></tr>";
$query2="SELECT * FROM ".$table_prefix."device WHERE deviceid=".$row["device_model"].";";
$result2=mysqli_query($connection,$query2);
$row2=mysqli_fetch_assoc($result2);
echo "<tr><td>Device model</td><td><input type='text' class='textbox' id='dev_name' name='dev_name' value=\"".$row2["dev_name"]."\"></td></tr>";
$row3["name"]="";
if($row["lenid"]!=Null){
$query3="SELECT * FROM ".$table_prefix."lens WHERE lensid=".$row["lenid"].";";
$result3=mysqli_query($connection,$query3);
$row3=mysqli_fetch_assoc($result3);
}
echo "<tr><td>Lens</td><td><input type='text' class='textbox' id='lens' name='lens' value=\"".$row3["name"]."\"></td></tr>";
$row3["name"]="";
if($row["app"]!=Null){
$query3="SELECT * FROM ".$table_prefix."app WHERE appid=".$row["app"].";";
$result3=mysqli_query($connection,$query3);
$row3=mysqli_fetch_assoc($result3);
}
echo "<tr><td>Application</td><td><input type='text' class='textbox' id='app' name='app' value=\"".$row3["name"]."\"></td></tr>";
echo "<tr><td><button name='submit' id='submit' type='submit' class='btn'>Update</button></td></tr>";
echo "</table>";
echo "</form>";
}
}
#closing the connection
mysqli_close($connection);
?>