Jump to content

Drummin

Members
  • Posts

    1,004
  • Joined

  • Last visited

Everything posted by Drummin

  1. Seemed to work fine for me. Toggled pages no prob.
  2. Where are you using 'photo' still? Undefined index: photo in ... basicpackage-send.php on line 16 Thought we had name changed to 'upload'?
  3. In your form you are using <input type="file" name="upload"> So "upload" is the name you're using. In processing, you need to use this same name. <?php //This is the directory where images will be saved $target = "/images/COMPANIES/"; $filename = stripslashes($_FILES['upload']['name']); $target = $target.$filename; //This gets all the other information from the form $company_name=$_POST['company_name']; $basicpackage_description=$_POST['basicpackage_description']; $location=$_POST['location']; $postcode=$_POST['postcode']; $upload=$filename; // Connects to your Database mysql_connect("******host", "****username", "****password") or die(mysql_error()) ; mysql_select_db("****DB") or die(mysql_error()) ; //Writes the information to the database $company_name = mysql_real_escape_string($company_name); $basicpackage_description = mysql_real_escape_string($basicpackage_description); $location = mysql_real_escape_string($location); $postcode = mysql_real_escape_string($postcode); $upload = mysql_real_escape_string($upload); mysql_query("INSERT INTO `Companies` VALUES ('$company_name', '$basicpackage_description', '$location', '$postcode', '$upload')") ; //Writes the photo to the server if(move_uploaded_file($_FILES['upload']['tmp_name'], $target)) { //Tells you if its all ok echo "The file ". $_FILES['upload']['name']. " has been uploaded, and your information has been added to the directory"; } else { //Gives and error if its not echo "Sorry, there was a problem uploading your file."; } ?>
  4. I don't work with cookies much but it seems the last call you should make is session_destroy(); session_start(); session_unset(); $_SESSION = array(); setcookie(session_name(), '', time() - 3600); setcookie('username', '', time() - 3600); session_destroy();
  5. Adding $_FILES['photo']['error'] will show an error number (good or bad), which can identify what's going on. See error codes here. http://php.net/manual/en/features.file-upload.errors.php
  6. Are you using 'photo' or 'uploadedfile' in your form?
  7. Drummin

    else

    To answer original question, look at your IF statement and how it's missing the opening bracket that corresponds to the ELSE as QuickOldCar pointed out.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.