I have a problem whit form submission. I have a html form and the action simpli doesnt want to work. maybe i am doing something wrong, but here take a look at it:
<form action="add.php" method="post" autocomplete="off">
<input type="text" name="title" placeholder="Title" style="width:300px;">
<select id="type" name="type">
<option value="0">Matrix</option>
<option value="1">LoL</option>
<option value="2">Dota 2</option>
</select><br />
<textarea rows="30" cols="90" placeholder="Content here" name="content"></textarea><br />
<input type="submit" value="DODAJ">
</form>
so when i click on the button i does refresh the page but nothing is displayed. I't worked in local but when i upload it online nothnig, just a blank page. And the stuff that has to go to the database doesnt go. no errors, no nothing.
help?
Here's the complete code for that add.php page:
<?php
include '../php/db/init.php';
include '../php/db/connection.php';
protect_page();
admin_protect();
if(isset($_SESSION['logged_in'])){
if(isset($_POST['title'], $_POST['content'], $_POST['type'])){
$title = $_POST['title'];
$content = nl2br($_POST['content']);
$content_short = substr($content,0, 150);
$type = $_POST['type'];
echo $type;
die();
if(empty($title) or empty($content) or empty($type)){
$error = 'Potrebno je popuniti sva polja!';
} else {
$query = $pdo->prepare('INSERT INTO articles (article_title, article_content, article_content_short, article_timestamp, article_type) VALUES (?,?,?,?,?)');
$query->bindValue(1,$title);
$query->bindValue(2,$content);
$query->bindValue(3,$content_short);
$query->bindValue(4,time());
$query->bindValue(5,$type);
$query->execute();
redirect('http://www.matrixgamingns.com/admin/index.php');
}
}
?>
<html>
<head>
<title>Matrix Gaming Admin Panel</title>
<link rel="stylesheet" type="text/css" href="../css/admin.css">
<link rel="stylesheet" type="text/css" href="../css/reset.css">
</head>
<body>
<div id="home">
<div id="wrapper">
<?php include 'adminmenusidebar.php'; ?>
<div id="field">
<h3 style="font-size:22px;">Dodaj vest</h3>
<?php if(isset($error)){ ?>
<small style="color:#aa0000"> <?php echo $error?> </small>
<br/>
<?php }?>
<br />
<form action="add.php" method="post" autocomplete="off">
<input type="text" name="title" placeholder="Title" style="width:300px;">
<select id="type" name="type">
<option value="0">Matrix</option>
<option value="1">LoL</option>
<option value="2">Dota 2</option>
</select><br />
<textarea rows="30" cols="90" placeholder="Content here" name="content"></textarea><br />
<input type="submit" value="DODAJ">
<?php
ini_set('display_errors','On');?>
</form>
</div>
</div>
</div>
</body>
</html>
<?php
} else {
redirect('http://www.matrixgamingns.com/admin/index.php');
}
?>
Get rid of the die() after echo $type;
By including a die() function, it stops all in its tracks, just like return does and nothing gets executed afterwards.
You could use the login form example posted here: HTML Dynamic Forms Generator
I downloaded the source code for the login form and it saved me lots of time.
Related
This question already has an answer here:
PHP form - if honeypot input field is filled - redirect to another page
(1 answer)
Closed 9 months ago.
I have a 2-page form to gather potential client data, and using a honeypot field to stop spam from entering our database table.
The code inserts the data into the table, so that is not an issue.
What I want to have happen is if the honeypot field is NOT NULL, then I want it to redirect to the noway.html file. Otherwise, redirect to the home.html file.
index.php:
<?php
session_start();
require_once 'config/config.php';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Purchase Form | HomePromise</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/js-cookie#2/src/js.cookie.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<link rel="stylesheet" href="../../assets/css/style.css" />
</head>
<body>
<div class="container box">
<h2 class="page-title" align="center">Purchase Form</h2><br />
<form method="post" id="refi_form" action="index2.php">
<div class="tab-content" style="margin-top:16px;">
<div class="tab-pane active" id="fins_details">
<div class="panel panel-default">
<div class="panel-body">
<div class="form-group">
<!-- Refi label: <label>What's the value of your home?</label> -->
<input type="hidden" name="branch" id="branch" class="form-control" value="Army" />
</div>
<div class="form-group">
<label>What is the sales price of your home?</label>
<select name="salesprice" id="salesprice" class="form-control">
<option value="">Select One</option>
<option value="75000">50,000 - 99,999</option>
<option value="150000">100,000 - 199,999</option>
<option value="250000">200,000 - 299,999</option>
<option value="350000">300,000 - 399,999</option>
<option value="450000">400,000 - 499,999</option>
<option value="550000">500,000 - 599,999</option>
<option value="650000">600,000 - 699,999</option>
<option value="700000">Over 700,000</option>
<span id="error_salesprice" class="text-danger"></span>
</select>
</div>
<div class="form-group">
<label>What loan amount do you want?</label>
<select name="loan_amount" id="loan_amount" class="form-control">
<option value="">Select One</option>
<option value="75000">50,000 - 99,999</option>
<option value="150000">100,000 - 199,999</option>
<option value="250000">200,000 - 299,999</option>
<option value="350000">300,000 - 399,999</option>
<option value="450000">400,000 - 499,999</option>
<option value="550000">500,000 - 599,999</option>
<option value="650000">600,000 - 699,999</option>
<option value="700000">Over 700,000</option>
<span id="error_loan_amount" class="text-danger"></span>
</select>
</div>
<div class="form-group">
<label>What is your yearly income?</label>
<select name="income" id="income" class="form-control">
<option value="">Select One</option>
<option value="25000">Under 25k</option>
<option value="37000">25k - 49k</option>
<option value="62000">50k - 74k</option>
<option value="87000">75k - 99k</option>
<option value="125000">100k - 149k</option>
<option value="175000">150k - 200k</option>
<option value="200000">Over 200k</option>
<span id="error_income" class="text-danger"></span>
</select>
</div>
<br />
<div align="right">
<input type='submit' name='save' id='btn_fins_details' style="background-color:rgb(50,50,200);color:#fff;font-size:1.5em;padding:10px;" value="Next">
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</body>
<script src="../assets/js/script.js"></script>
</html>
index2.php (Note: I am only echoing the values to verify that the honeypot and other values are being stored in their sessions.):
<?php
session_start();
$_SESSION['branch'] = $_POST['branch'];
$_SESSION['salesprice'] = $_POST['salesprice'];
$_SESSION['loan_amount'] = $_POST['loan_amount'];
$_SESSION['income'] = $_POST['income'];
$_SESSION['formurl'] = $_SERVER['HTTP_REFERER'];
echo $_SESSION['branch']; ?><br><?php
echo $_SESSION['salesprice']; ?><br><?php
echo $_SESSION['loan_amount']; ?><br><?php
echo $_SESSION['income']; ?><br><?php
echo $_SESSION['formurl']; ?><br><?php
$client_url = $_POST['client_url'];
require_once 'config/config.php';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Refinance Form | HomePromise</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<link rel="stylesheet" href="../../assets/css/style.css" />
</head>
<body>
<div class="container box">
<br />
<h2 class="page-title" align="center">Purchase Form</h2><br />
<form method="post" id="refi_form" action="submit.php">
<div class="tab-content" style="margin-top:16px;">
<div class="tab-pane active" id="fins_details">
<div class="panel panel-default">
<div class="panel-body">
<table class="center">
<tr>
<td class="left">
<div class="form-group">
<label>First Name</label>
<input type="hidden" name="formurl" value="<?php echo $_SESSION['formurl']; ?>">
<input type="hidden" name="client_url" value="<?php echo $_SESSION['client_url']; ?>">
<input type="hidden" name="ip" value="<?php echo $_SESSION['ip']; ?>"></input>
<input type="hidden" name="branch" value="<?php echo $_SESSION['branch']; ?>"></input>
<input type="hidden" name="salesprice" value="<?php echo $_SESSION['salesprice']; ?>"></input>
<input type="hidden" name="loan_amount" value="<?php echo $_SESSION['loan_amount']; ?>"></input>
<input type="hidden" name="income" value="<?php echo $_SESSION['income']; ?>"></input>
<input type="hidden" name="transaction_type" id="transaction_type" value="Purchase">
<input type="text" name="fName" id="fName" class="form-control" />
<span id="error_fName" class="text-danger"></span>
</div>
</td>
</tr>
</table>
<br />
<div class="text-message" style="display: block;">
<p>By clicking submit below, I/we acknowledge that I/we have read and agree to the User Agreement and acknowledge that I/we have read the Privacy Statement, and Disclosures.</p>
<br />
</div>
<div align="right">
<input type='submit' name='save' id='btn_personal_details' style="background-color:rgb(50,50,200);color:#fff;font-size:1.5em;padding:10px;" value="Submit">
</div>
</div>
</div>
</div>
</form>
</div>
</body>
<script src="..assets/js/script.js"></script>
</html>
submit.php:
<?php
session_start();
$_SESSION['branch'] = $_POST['branch'];
require_once 'config/config.php';
if (isset($_POST['client_url']) && $_POST['formurl'] && $_POST['ip'] && $_POST['salesprice'] && $_POST['loan_amount'] && $_POST['transaction_type'] && $_POST['fName'] && (empty($_POST['branch']))) {
$client_url = $_POST['client_url'];
$formurl = $_POST['formurl'];
$ip = $_POST['ip'];
$salesprice = $_POST['salesprice'];
$loan_amount = $_POST['loan_amount'];
$income = $_POST['income'];
$transaction_type = $_POST['transaction_type'];
$fName = $_POST['fName'];
$sql = "INSERT INTO whp (client_url, formurl, ip, salesprice, loan_amount, income, transaction_type, fName) VALUES ('$client_url', '$formurl', '$ip', '$salesprice', '$loan_amount', '$income', '$transaction_type', '$fName')";
$db_con->exec($sql);
header("Location: home.html");
} else {
header("Location: noway.html");
}
?>
Create your honeypot input (name can be whatever, in my example I'm using honeypot).
if (empty($_POST['honeypot'])){
Add that just after the $sql string is set (or just before).
empty will return true if the variable is undefined or set to false. In terms of a POST value, that means it will be true if the POST value is not set or is blank (and you should trigger home.html). If it's filled, it it will return false and you should trigger the else noway.html.
in my code its directly saving the values into database but I want to show preview page for Textfield values and then after I want to submit the details into Database.How to do that?
please guide me
<?php
if(isset($_POST['submit'])){
$name=$_POST['name'];
$course=$_POST['course'];
$query="insert into student_tbl(`name`,`course`) values('$name','$course')";
if ($conn->query($query) === TRUE){
header("location: home.php");
}
else {
echo "Error: " . $sql . "<br>" . $conn->error;
}
$conn->close();
}
?>
This is simple form where am trying with only two values
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="shortcut icon" href="img/favicon.png">
</head>
<body>
<form action="" method="POST" id="myform" class="mform" enctype="multipart/form-data">
<div class="col-sm-12">
<label for="name">name: </label>
<input class="form-control" type="text" id="name" name="course" />
</div>
<div class="col-sm-12">
<label for="course">Course: </label>
<select name="course" id="course">
<option value="" disabled>select users</option>
<option value="Computer">Computer</option>
<option value="Physics">Physics</option>
<option value="Chemistry">Chemistry</option>
<option value="Maths">Maths</option>
</select>
</div>
<div class="col-sm-12">
<input class="form-control" type="submit" value="Preview" />
<input class="form-control" type="submit" formaction="formdata.php" value="Cancel" />
</div>
</form>
</body>
</html>
Use your first code snippet and add a boolean which switches it's value to true after the method is called. When you submit successfully you can set it to false again.
$confirm = true;
if($confirm) {
//Show confirmation html
} else {
//Query Form values (e.g. database)
$confirm = true;
}
First Save the value in session variable like
$_SESSION['name']=$_POST['name'];
$_SESSION['course']=$_POST['course'];
Then in Next print SESSION value
echo $_SESSION['name'];
echo $_SESSION['course'];
Then in this page fire insert query
$name=$_SESSION['name'];
$course=$_SESSION['course'];
$query="insert into student_tbl(`name`,`course`) values('$name','$course')";
Here's the code:
<html>
<head>
<title>emarket.com</title>
<link rel="stylesheet" type="text/css" href="./style.css"/>
</head>
<header>
<h1>emarket.com</h1>
<h1>Post Ad</h1>
</header>
<body>
<?php
if(!empty($_POST)){
$title=$_POST['title'];
$description=$_POST['description'];
$district=$_POST['district'];
$phone=$_POST['phone'];
$catagory=$_POST['catagory'];
$price=$_POST['price'];
mysql_connect("localhost","root","");
mysql_select_db("maindb");
mysql_query("INSERT into allads VALUES(NULL,'$title','$phone','$description', '$price','$district','$catagory')");
echo "<span style='background-color: deepskyblue;'>Your advert is now online!</span>";
}
?>
<form class="postad" method="post" action="">
<fieldset><caption><h2>Post New Advert</h2></caption></fieldset>
<fieldset>
<label>Title</label><br/>
<input type="text" name="title" class="form-text" required>
</fieldset>
<fieldset>
<label>Description</label><br/>
<input name="description" class="form-text" required>
</fieldset>
<fieldset>
<label>District</label><br/>
<select name="district"required>
<option selected>Colombo</option>
<option>Kandy</option>
<option>Matara</option>
<option>Galle</option>
</select>
</fieldset>
<fieldset>
<label>Category</label><br/>
<select name="catagory"required>
<option value="Electronics">Electronics</option>
<option value="Property">House and Property</option>
<option value="Auto">Automobiles</option>
<option value="Misc">Miscellaneous</option>
</select>
</fieldset>
<fieldset>
<label>Phone</label><br/>
<input type="tel" name="phone" maxlength="10" class="form-text" required>
</fieldset>
<fieldset>
<label>Price</label><br/>
Rs. <input type="number" name="price" class="form-text" required>
</fieldset>
<fieldset>
<input type="submit" name="submit" value="submit"/>
</fieldset>
</form>
</body>
</html>
This happened after I entered the PHP parts, it was visible in Firefox before that. Other files having PHP, like the home page, works fine. In chrome not only the website is visible, it works fine too. Stuff from the form gets inserted into the sql table without any problems.
Do you have the slightest idea of how vulnerable you are to mysql injection attacks? Please start using pdo. mysql_* is deprecated.
I've cleaned the function for you. The php part will only be executed once you click the submit button.
<?php
mysql_connect("localhost","root","");
mysql_select_db("maindb");
if(isset($_POST['submit']))
{
$title=isset($_POST['title']) ? $_POST['title'] : '';
$description=isset($_POST['description']) ? $_POST['description'] : '';
$district=isset($_POST['district']) ? $_POST['district'] : '';
$phone=isset($_POST['phone']) ? $_POST['phone'] : '';
$catagory=isset($_POST['catagory']) ? $_POST['catagory'] : '';
$price=isset($_POST['price']) ? $_POST['price'] : '';
if(!empty($title) && !empty($description) && !empty($district) && !empty($phone) && !empty($catagory) && !empty($price))
{
$q = mysql_query("INSERT into allads VALUES(NULL,'$title','$phone','$description', '$price','$district','$catagory')");
if($q)
{
echo "<span style='background-color: deepskyblue;'>Your advert is now online!</span>";
}
else
{
echo "Could not update DB";
}
}
}
?>
<html>
<head>
<title>emarket.com</title>
<link rel="stylesheet" type="text/css" href="./style.css"/>
</head>
<header>
<h1>emarket.com</h1>
<h1>Post Ad</h1>
</header>
<body>
<form class="postad" method="post" action="">
<fieldset><caption><h2>Post New Advert</h2></caption></fieldset>
<fieldset>
<label>Title</label><br/>
<input type="text" name="title" class="form-text" required>
</fieldset>
<fieldset>
<label>Description</label><br/>
<input name="description" class="form-text" required>
</fieldset>
<fieldset>
<label>District</label><br/>
<select name="district"required>
<option selected>Colombo</option>
<option>Kandy</option>
<option>Matara</option>
<option>Galle</option>
</select>
</fieldset>
<fieldset>
<label>Category</label><br/>
<select name="catagory"required>
<option value="Electronics">Electronics</option>
<option value="Property">House and Property</option>
<option value="Auto">Automobiles</option>
<option value="Misc">Miscellaneous</option>
</select>
</fieldset>
<fieldset>
<label>Phone</label><br/>
<input type="tel" name="phone" maxlength="10" class="form-text" required>
</fieldset>
<fieldset>
<label>Price</label><br/>
Rs. <input type="number" name="price" class="form-text" required>
</fieldset>
<fieldset>
<input type="submit" name="submit" value="submit"/>
</fieldset>
</form>
</body>
</html>
?>
Edit :- IN situations like these, it's always better to put your php code before <html>
Also, what's your filename in which all this code exists? Put that filename in the <Form action="filenamehere.php">.
If it still doesn't work, upload it somewhere to let me have a closer look.
Your header tag should be inside the body tag.
<body>
<header>
<h1>emarket.com</h1>
<h1>Post Ad</h1>
</header>
Like #Akshay said, you should be using PDO, however you should be escaping your input using something like mysql_real_escape_string($value) before putting it into the database if you aren't using PDO.
I'm used to using CIN, of C++, to get a input into a var... Its really EASY!
So, I'm starting learn PHP.
And, I'm testing show on the screen what the user input in a form.
I know its a easy thing, but I am not achieving.
The form is in this file:
- html5.html
<div id="form">
<form action="test.php" method="post" >
<label for="code"> Code </label> <br />
<input type="password" id="coded" name="code" /> <br /> <br />
<hr />
<select name="modo-log[]" id="choose">
<option class="select_mod" value="professor">Professor</option>
<option class="select_mod" value="student" selected="selected">Student</option>
<option class="select_mod" value="user">User</option>
<option class="select_mod" value="adm">Adm</option>
</select>
<hr />
<button> Entrar </button>
</form>
And the PHP file:
- test.php
<?php
$code = $_POST['code'];
echo "$code";
$type_entered = $_POST['modo-log'];
echo "$type_enterd";
?>
But, I dont Know what I'm doing wrong...
The page just gets blank.
Help me?
Thanks.
Add type="submit" attribute in <button> tag. SO that it will submit your form request
Change
<button> Entrar </button>
to
<button type="submit">Entrar</button>
This following setup should tell you whats wrong :)
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
?>
<div id="form">
<form action="" method="post" >
<label for="code"> Code </label> <br />
<input type="password" id="coded" name="code" /> <br /> <br />
<hr />
<select name="modo-log[]" id="choose">
<option class="select_mod" value="professor">Professor</option>
<option class="select_mod" value="student" selected="selected">Student</option>
<option class="select_mod" value="user">User</option>
<option class="select_mod" value="adm">Adm</option>
</select>
<hr />
<button type="submit">Entrar</button>
</form>
<?php var_dump($_POST); ?>
I'm almost sure that my apache is wrong installed...
It'snt possible! I cannot do a simple test!
When I suspected the trouble was the apache, I tryed only this:
<!DOCTYPE html>
<html>
<body>
<?php
$varr_1 = 1;
$varr_2 = 2;
$varr_3 = $varr_1 + $varr_2;
echo $varr_3;
?>
</body>
</html>
And I didn't got any result. The page gets blank yet.
thanks to those who tried to help, I'll create a website on 000webhost to run php, whereas I've already tryed reinstalling the apache.
I'm sad....
Bye
I have created a simple form. In the form there is a option to upload photo. I have created that and submitted successfully. But when I updated the mozilla firefox browser to 8.0 the form showing problem. When I submit the form in firefox 8.0 the browser hangs only because of the upload photo section, all other are working well while the same code is running in internet explorer. Then I installed old version of firefox same code is running well. I don't understand why it is happening and what will be the solution? Please help me. Thanks in advance...
Here is the code....
<?php
session_start();
if(!isset($_SESSION['user']))
{
header("Location:index.php");
exit();
}
include("./include/dbc.php");
$msg='';
if(isset($_POST['check'])){
$p=$_FILES['photo']['name'];
$q=$_FILES['photo1']['name'];
if($_REQUEST['a_name'] == '' ||$_REQUEST['b_name'] == ''||$_REQUEST['no_flats'] == ''||$p == ''||$q == '')
{
$msg='Enter Details!!';
}
if($msg==''){
$target = "images/";
$target = $target . basename( $_POST['a_name'].$_FILES['photo']['name']);
$pic=$_POST['a_name'].$_FILES['photo']['name'];
$target1 = "loc_images/";
$target1 = $target1 . basename( $_POST['a_name'].$_FILES['photo1']['name']);
$pic1=$_POST['a_name'].$_FILES['photo1']['name'];
$time=$_POST['month'].' '.$_POST['year'];
$sql= "INSERT INTO flats
SET
app_name = '$_REQUEST[a_name]',
builder = '$_REQUEST[b_name]',
loc_id = '$_REQUEST[loc]',
status_id = '$_REQUEST[status]',
no_of_flats = '$_REQUEST[no_flats]',
completion_time = '$time',
main_pic = '$pic',
loc_map = '$pic1'";
$result=mysql_query($sql) or die(mysql_error());
move_uploaded_file($_FILES['photo']['tmp_name'], $target);
move_uploaded_file($_FILES['photo1']['tmp_name'], $target1);
$id=$_REQUEST['a_name'];
$sql2 =mysql_query("select id from flats where app_name='$id'");
while ($result= mysql_fetch_row($sql2)){
$_SESSION['flat_id']=$result[0];
}
header("Location:new1.php");
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<form id="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" enctype="multipart/form-data">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Welcome To Prime Properties</title>
<link rel="stylesheet" href="style.css" type="text/css"/>
</head>
<body>
<div class="container">
<div class="heading">
<div class="banner"><img src="../images/top.jpg" width="995" height="169" /></div>
<!--menu start-->
<div>
<?php include('include/menu.php');?>
</div>
<!--menu end-->
</div>
<div class="main">
<!--left menu start-->
<div class="left_menu">
<?php include('include/lm.php');?>
</div>
<!--left menu end-->
<div class="divider"></div>
<!--body contant goes here-->
<div class="right">
<div id="error">
<?php
echo $msg;
?></div>
<p>
Enter Your Credentials......</p>
<fieldset><p class="first">
<label for="a_name">Appartment Name:</label>
<input type="text" name="a_name" id="a_name"><br/></input></p>
<p>
<label for="b_name">Builder Name:</label>
<input type="text" name="b_name" id="b_name"><br/></input></p>
<p>
<label for="loc">Location:</label>
<select name="loc">
<option value="1">Maligaon</option>
<option value="2">Panbazaar</option>
<option value="3">Fancy Bazar</option>
<option value="4">Kahilipara</option>
<option value="5">Noonmati</option>
<option value="6">Lokhra</option>
<option value="7">Jalukbari</option>
<option value="8">Chandmari</option>
<option value="9">Beltola</option>
<option value="10">Dispur</option>
</select><br/></p>
<p>
<label for="status"> Status:</label>
<select name="status">
<option value="1">Ongoing</option>
<option value="2">Future</option>
<option value="3">Completed</option>
</select><br/></p>
<p><label for="no_flats">No of Flats:</label>
<input type="text" name="no_flats" id="no_flats"><br/></input></p>
<p><label for="c_time">Completion Time:</label>
<select name="month">
<option>Month</option>
<option>January</option>
<option>February</option>
<option>March</option>
<option>April</option>
<option>May</option>
<option>June</option>
<option>July</option>
<option>August</option>
<option>September</option>
<option>October</option>
<option>November</option>
<option>December</option>
</select>
<select name="year">
<option>Year</option>
<option>2012</option>
<option>2013</option>
<option>2014</option>
<option>2015</option>
<option>2016</option>
<option>2017</option>
<option>2018</option>
<option>2019</option>
<option>2020</option>
</select>
</p>
<p><label for="m_pic">Main Picture:</label>
<input type="file" name="photo"/><br/></p>
<p><label for="l_map">Location Map:</label>
<input type="file" name="photo1"/><br/></p>
<p class="submit">
<input type="hidden" name="check" value="1"/>
<button type="submit" name="submit" >NEXT</button></p>
</fieldset></div>
<!--body contant end here -->
</div>
</div>
</body>
</html>
</form>
Your:
<form id="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" enctype="multipart/form-data">
Cannot be outside of the <body>, and you stuck yours outside of the <head> even.
Try to only wrap what you need in your <form></form> tags.
That is most likely the problem!