Hi
I have an occasional problem with the following scripts
Here is the file upload form
<?php
session_start();
if(isset($_SESSION['username']) == false){
header("Location: login.php");
exit();
}
if(($_SESSION['userlevel']) != 'admin'){
header("Location: login.php");
exit();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>LCAC Administration</title>
<LINK href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="container">
<div id="header">
<table width="980px">
<tr>
<td align="left"><img src="images/lcaclogo.gif" width="100px" height="100px"></td>
<td><h1>LCAC Administration</h1></td>
</tr>
</table>
</div>
<div id="navigation"><ul><li>Add New Contact - Upload Photo</li></ul></div>
<div id="content-container">
<div id="section-navigation">
<ul>
<li><a href="viewcontactlistadmin.php">Contact List Admin</a></li>
<li><a href="logout.php">Log Out</a></li>
</ul>
</div>
<div id="content">
<center><img src="images/newcontactstepone.jpg"></center>
<p>To add a new contact you must first <b><u>upload a photo</u></b>. Once you have added a photo you will be taken to a form to add the information about the contact</p>
<form enctype="multipart/form-data" action="processupload.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
<center>Choose photo to upload: <input name="uploadedfile" type="file" /><br><br>
<input type="submit" value="Go to next step >>" /><center>
</form>
</div>
<div id="footer">Copyright © LCAC, 2011</div>
</div>
</body>
</html>
Here is the contact details form:
<?php
session_start();
if(isset($_SESSION['username']) == false){
header("Location: login.php");
exit();
}
if(($_SESSION['userlevel']) != 'admin'){
header("Location: login.php");
exit();
}
require "connect.php";
$filename = $_GET['file'];
$query= "SELECT Name FROM diocese";
$result = mysql_query($query, $connection)
or die("Unable to perform query<br>$query");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>LCAC Administration</title>
<LINK href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="container">
<div id="header">
<table width="980px">
<tr>
<td align="left"><img src="images/lcaclogo.gif" width="100px" height="100px"></td>
<td><h1>LCAC Administration</h1></td>
</tr>
</table>
</div>
<div id="navigation"><ul><li>Add Contact</li></ul></div>
<div id="content-container">
<div id="section-navigation">
<ul>
<li><a href="index.php">Home</a></li>
<li><a href="contactlistadmin.php">Contact List Admin</a></li>
<li><a href="logout.php">Log Out</a></li>
</ul>
</div>
<div id="content">
<center><img src="images/newcontactsteptwo.jpg"></center>
<center>
<form enctype="multipart/form-data" name="addcontact" action="processaddcontact.php" mehtod="POST">
<fieldset>
<legend>Name</legend>
<label class="label">Title</label> <input type="text" name="title"><br>
<label class="label">Firstname</label> <input type="text" name="firstname"><br>
<label class="label">Surname</label> <input type="text" name="surname"><br>
</fieldset>
<fieldset>
<legend>Address</legend>
<label class="label">House No/Name</label> <input type="text" name="house"><br>
<label class="label">Street</label> <input type="text" name="street"><br>
<label class="label">Town/City</label> <input type="text" name="town"><br>
<label class="label">County</label> <input type="text" name="county"><br>
<label class="label">Country</label> <input type="text" name="country"><br>
<label class="label">Zip/Postcode</label> <input type="text" name="postcode">
</fieldset>
<fieldset>
<legend>Internet</legend>
<label class="label">Email</label> <input type="text" name="email"><br>
<label class="label">Website</label> <input type="text" name="website">
</fieldset>
<fieldset>
<legend>Telephone Numbers</legend>
<label class="label">Home</label> <input type="text" name="home"><br>
<label class="label">Mobile</label> <input type="text" name="mobile"><br>
</fieldset>
<fieldset>
<legend>Parish</legend>
<label class="label">Diocese/Order</label>
<select name="diocese">
<?php
while ($row = mysql_fetch_array($result)) {
echo "<option value='" . $row['Name'] . "'>" . $row['Name'] . "</option>";
}
?>
</select>
<label class="label">Parish</label> <input type="text" name="parish"><br>
<label class="label">Additional Info</label> <input type="text" name="additionalinfo">
</fieldset>
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
<input name="uploadedfile" type="hidden" value="<?php echo "$filename"; ?>" /><br />
</fieldset>
<br>
<input class="submit" name="submit" type="submit" value="Add Contact">
<br>
</form>
</center>
</div>
<div id="footer">Copyright © LCAC, 2011</div>
</div>
</body>
</html>
Here is the proccesaddcontact.php
<?php
session_start();
require "connect.php";
$title= $_GET['title'];
$firstname= $_GET['firstname'];
$surname= $_GET['surname'];
$house= $_GET['house'];
$street= $_GET['street'];
$town= $_GET['town'];
$county= $_GET['county'];
$country= $_GET['country'];
$postcode= $_GET['postcode'];
$email= $_GET['email'];
$website= $_GET['website'];
$home= $_GET['home'];
$mobile= $_GET['mobile'];
$diocese = $_GET['diocese'];
$parish= $_GET['parish'];
$moreinfo= $_GET['additionalinfo'];
$photo= $_GET['uploadedfile'];
$query = "insert into contacts values(0,
'".$title."',
'".$firstname."',
'".$surname."',
'".$house."',
'".$street."',
'".$town."',
'".$county."',
'".$country."',
'".$postcode."',
'".$email."',
'".$website."',
'".$home."',
'".$mobile."',
'".$diocese."',
'".$parish."',
'".$moreinfo."',
'".$photo."')";
$result = mysql_query($query, $connection)
or die ("Unable to perform query" . mysql_error());
header("Location: viewcontactlistadmin.php");
?>
I can upload some files but others do not upload to server please can someone help me?
Thanks
Chris