Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <h3>Wildlife Collision Record</h3>
- <?php
- require_once("db.php");
- $species1 = $_REQUEST['species'];
- $species2 = $_REQUEST['txtSpecies'];
- $gender = $_REQUEST['rbGender'];
- $age = $_REQUEST['rbAge'];
- $date = $_REQUEST['rpDate'];
- $location = $_REQUEST['location'];
- $latitude = $_REQUEST['lat'];
- $longitude = $_REQUEST['lng'];
- if ($species1 === "Others");
- $species1 = $species2;
- if (!empty($species1) && is_string($species1) && !empty($location)&& is_string($location))
- {
- $imgURL = null;}
- ?>
- <p>Your information been recorded.</p>
- <dl>
- <dt>Species:</dt>
- <dd><?php print $species1; ?></dd>
- </dl>
- <dl>
- <dt>Gender:</dt>
- <dd><?php print $gender; ?></dd>
- </dl>
- <dl>
- <dt>Age:</dt>
- <dd><?php print $age; ?></dd>
- </dl>
- <dl>
- <dt>Date:</dt>
- <dd><?php print $date; ?></dd>
- </dl>
- <dl>
- <dt>Location:</dt>
- <dd><?php print $location; ?></dd>
- </dl>
- <dl>
- <dt>Latitude:</dt>
- <dd><?$latitude = is_numeric($latitude)? $latitude : "NULL"; print $latitude; ?></dd>
- </dl>
- <dl>
- <dt>Longitude:</dt>
- <dd><?$longitude = is_numeric($longitude) ? $longitude : "NULL"; print $longitude;; ?></dd>
- </dl>
- <?php
- if ($_FILES["imgFile"]["error"] > 0)
- {
- // Something happened that prevented the file from uploading...
- print ("<p>File Upload Error: " . $_FILES["imgFile"]["error"] . "</p>");
- }
- elseif(
- ($_FILES["imgFile"]["type"] == "image/gif") ||
- ($_FILES["imgFile"]["type"] == "image/jpeg") ||
- ($_FILES["imgFile"]["type"] == "image/jpg") ||
- ($_FILES["imgFile"]["type"] == "image/png") &&
- ($_FILES["imgFile"]["size"] < 1000000)
- )
- {
- // The file uploaded without any issues, so get...
- // - file name
- $filename = $_FILES["imgFile"]["name"];
- // - tmp name
- $tmpname = $_FILES["imgFile"] ["tmp_name"];
- // - path
- $path = "uploads\\";
- // ...set the destination...
- $imgURL = $destpath . $filename;
- // ...and try to copy the file...
- if(file_exists($imgURL))
- {
- // - The file already exists... That's an error!
- print("<p>File Upload Error: " . $filename . " already exists.</p>");
- }
- else
- {
- // - Try to move the uploaded file to the destination
- if(move_uploaded_file($tmpname, $imgURL))
- {
- // - It worked, so let the user know it worked
- print("<p>File " . $filename . " uploaded successfully.</p>");
- }
- else
- {
- // - An error occurred, so let the user know:
- print("<p>File Upload Error: " . "File cannot be moved.</p>");
- }
- }
- }
- else
- {
- // - Some other error occurred, let the user know...
- print("<p>File upload Error:Invalid File </p>");
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement