I have a form that is submitting photo filepath to database on top of some other text. When I submit the form it only show blank page and I’m not sure where it is going wrong
Here is the form…
[php]
Step 1. Choose a picture:
Step 2. Enter a caption for the image
Step 3. Judg whatever/whoever is in that picture:
(Maximum characters: 350)
You have characters left.
<input type="hidden" name="url" value='<?php echo "Date:".date('Y-m-d H:i:s')."<br />Ip:".$_SERVER['REMOTE_ADDR'].""?>'/>
<label for="submit"><span class="steps">Step 4.</span> Submit it:</label>
<br>
<input name="upload" type="submit" id="upload" value="JUDGD!"/>
</form>[/php]
And here is the upload script
[php]<?php include ‘db.php’;
$uploadDir = ‘uploaded_images/’; //Folder name for uploaded images
$limitedtextarea = addslashes(urldecode($_POST[‘limitedtextarea’])); //The actual judgment
$url = addslashes(urldecode($_POST[‘url’])); //URL (not yet implemented)
$figcaption = addslashes(urldecode($_POST[‘figcaption’])); //Caption for the image
//I believe the error begins here|/
if(isset($_POST[‘upload’]))
{
$fileName = $_FILES[‘userfile’][‘name’];
$tmpName = $_FILES[‘userfile’][‘tmp_name’];
$fileSize = $_FILES[‘userfile’][‘size’];
$fileType = $_FILES[‘userfile’][‘type’];
$image = $fileType;
$filePath = $fileName; //file path for inserting into database ex. image_name.jpg
$result = move_uploaded_file($tmpName,$uploadDir . $filePath); //file path for uploading to folder ex. uploaded_images/image_name.jpg
if (!$result) {
include ‘something_went_wrong.php’;
exit;
}
if(!get_magic_quotes_gpc())
{
$fileName = addslashes($fileName);
$filePath = addslashes($filePath);
}
else {
echo “error”;
}
$query = “INSERT INTO judgment (limitedtextarea, name, size, type, path, url, figcaption )
VALUES (’$limitedtextarea’,’$fileName’, ‘$fileSize’, ‘$fileType’, ‘$filePath’, ‘$url’, ‘$figcaption’)”;
mysql_query($query) or die('Error, query failed : ’ . mysql_error());
if($result){
include ‘judgment_posted.php’;
}
else {
include ‘something_went_wrong.php’;
}
}
?>[/php]