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!