can some one help me in this code PHP syntax?

this is the area where I got the problem
file: index_web_page2.php
<?php
//get the value of the selected radio value from index_web_page1.html
$n=$_POST['company'];
$dbhost="localhost";
$dbuser="root";
$dbpass="";
$dbname;
?>
<html><head><title>web page1</title></head><body>
<?php
// logical selection for $n

echo"You selected Company <font color=red>bhagis portal</font> <br>";
$dbname="bhagis_portal";
echo"<form action=\"index_web_page2.php\" method=\"post\" enctype=\"multipart/form-data\">
<input name=\"hiddenField\" type=\"hidden\" id=\"hiddenField\" value=\"999999\">
<input type=\"file\" id=\"timesheet\" name=\"timesheet\"><br>
<input type=\"submit\" name=\"cb_read\" id=\"cb_read\" value=\"Upload Timekeeping File\">
<input type=reset name=reset value=clear></form>";


$conn=mysql_connect($dbhost,$dbuser,$dbpass)or die("Error connecting to MySQL");
mysql_select_db($dbname)or die(mysql_error());
$query="Select * from img_table";
$row=mysql_query($query)or die(mysql_error());
while($result=mysql_fetch_array($row)){
echo $result[0].") ";
echo "<img src=/new/".$dbname."/images/".$result[1]."><br>";
}
$pic=$_files["timesheet"]["hiddenField"];
$destination='\xampp\htdocs\new'.'\'.$dbname.'\images'.'\'.$_files["timesheet"]["hiddenField"];
move_uploaded_file($pic,$destination);

/* key code */
$query="insert into img_table(img_name) values('".$pic."')";
mysql_close($conn);
?>
</body>
</html>

file:index_web_page1
<html>
<head><title>web page 1</title></head>
<form action="index_web_page2.php" method="post" enctype="multipart/form-data">
<b><font size=12>SELECT COMPANY</font></b><br>
<input type=radio name=company VALUE=1>bhagis portal<br>
<input type=radio name=company VALUE=2>bli portal<br>
<input type=radio name=company VALUE=3>m portal<br>
<input type=radio name=company VALUE=4>vg portal<br>

<input type=submit value=submit name=submit>
</form>
</html>


what i want to have is the capability to upload a picture... for now I try to focus this on one database which is bhagis_portal

My problem here right now is to be able to upload a file and move the uploaded and view the uploaded file at the time I was able to upload my file to bhagis portal

( I used the folder path method )

kindly please help me
 


Write your reply...
Back
Top