Jump to content

[SOLVED] sends the email and populates the database great


sandbudd

Recommended Posts

sends the email and populates the database but the link to download the images shows as example

 

<a href=http://www.company.com/rfq/uploads/Hawaii2008_0184462635.jpg>Hawaii2008_0184462635.jpg</a>

 

rather than clickable Hawaii2008_0184462635.jpg

 

this was working just fine and started doing this.

 


<?php


error_reporting(0);


session_start();


$db_host = ''; 


$db_user = ''; 


$db_pwd = '';


$database = '';


$table = 'ae_gallery';








if (!mysql_connect($db_host, $db_user, $db_pwd))


    die("Can't connect to database");





if (!mysql_select_db($database))


    die("Can't select database");


      


$Domain="http://".$_SERVER['HTTP_HOST'];


$customer = mysql_real_escape_string($_POST['customer']);


$company=mysql_real_escape_string($_POST['company']);


$address=mysql_real_escape_string($_POST['address']);


$city=mysql_real_escape_string($_POST['city']);


$state=mysql_real_escape_string($_POST['state']);


$zip_code=mysql_real_escape_string($_POST['zip_code']);


$email=mysql_real_escape_string($_POST['email']);


$phone=mysql_real_escape_string($_POST['phone']);


$fax=mysql_real_escape_string($_POST['fax']);


$type2=mysql_real_escape_string($_POST['type2']);


$type3=mysql_real_escape_string($_POST['type3']);


$burnish=mysql_real_escape_string($_POST['burnish']);


$chromate=mysql_real_escape_string($_POST['chromate']);


$hex=mysql_real_escape_string($_POST['hex']);


$impregnation=mysql_real_escape_string($_POST['impregnation']);


$strip=mysql_real_escape_string($_POST['strip']);


$part=mysql_real_escape_string($_POST['part']);


$description=mysql_real_escape_string($_POST['description']);


$alloy=mysql_real_escape_string($_POST['alloy']);


$quantity=mysql_real_escape_string($_POST['quantity']);


$spec=mysql_real_escape_string($_POST['spec']);


$color=mysql_real_escape_string($_POST['color']);


$repeat_customer=mysql_real_escape_string($_POST['repeat_customer']);


$isearch=mysql_real_escape_string($_POST['isearch']);


$idirectory=mysql_real_escape_string($_POST['idirectory']);


$referral=mysql_real_escape_string($_POST['referral']);


$yellow_pages=mysql_real_escape_string($_POST['yellow_pages']);


$trade=mysql_real_escape_string($_POST['trade']);


$other=mysql_real_escape_string($_POST['other']);


$notes=mysql_real_escape_string($_POST['notes']);


$finalfile=mysql_real_escape_string($_FILES['finalfile']);











$cdir="rfq/uploads";


$save_path="uploads/";  





$date = date("F j, Y, g:i a");





$file = $_FILES['userfile'];





$k = count($file['name']);





for($i=0;$i< $k ;$i++)


{





      if(isset($save_path) && $save_path!="")


      {


            $random_digit=rand(0000,9999999);


            $name = split('/',$file['name'][$i]);


            $name = str_replace("\\","",$name);


            $name = str_replace("'","",$name);


            $name = str_replace("","_",$name);


            $name = str_replace(" ","_",$name);


            $name = str_replace(".",$random_digit.".",$name);


            





            if(move_uploaded_file($file['tmp_name'][$i], $save_path . $name[count($name)-1]))


            {


            //// download the file/////


            $finalfile.="<a href=".$Domain."/".$cdir."/".$name[count($name)-1].">".$name[count($name)-1]."</a>";


            $list_files.="<li>".$name[count($name)-1]."</li>";





}


      }


      }


      


      


      ///message in the mail//////


      $msg="-- This is the Customer's information -- \r\n


      Full Name: $customer\r\n


      Company: $company\r\n


      Address: $address\r\n


      City: $city\r\n


      State: $state\r\n


      Zip: $zip_code\r\n


      Email: $email\r\n


      Phone Number: $phone\r\n


      Fax Number: $fax\r\n


      Process Requested?\r\n


      $type2\r\n


      $type3\r\n


      $burnish\r\n


      $chromate\r\n


      $hex\r\n


      $impregnation\r\n


      $strip\r\n


      Part Number: $part\r\n


      Part Description: $description\r\n


      Alloy: $alloy\r\n


      Quantity: $quantity\r\n


      Specifications: $spec\r\n


      Color: $color\r\n


      How did you hear about us?\r\n


      Repeat: $repeat\r\n


      Internet Search: $isearch\r\n


      Internet Directory: $idirectory\r\n


      Referral: $referral\r\n


      Yellow Pages: $yellow_pages\r\n


      Trade Show: $trade\r\n


      Other: $other\r\n


      Notes: $notes\r\n


      Attached files:\r\n


      $finalfile";


      


      


      ///email address////


      $to =  "mail@mail.com";


            


      ///Subject Title


      $subject="New Message";


      


      //$headers = "From: $email\n";


      $headers = "From: $email" . "\r\n" . "CC: mail@mail.com";


      


      if(mail($to,$subject,$msg,$headers))





?>


<?php


{


      


        	





mysql_query("INSERT INTO ae_gallery (customer,company,address,city,state,zip_code,email,phone,fax,type2,type3,burnish,chromate,hex,impregnation,strip,part,description,alloy,quantity,spec,color,repeat_customer,isearch,idirectory,referral,yellow_pages,trade,other,notes,finalfile) VALUES('$customer','$company','$address','$city','$state','$zip_code','$email','$phone','$fax','$type2','$type3','$burnish','$chromate','$hex','$impregnation','$strip','$part','$description','$alloy','$quantity','$spec','$color','$repeat_customer','$isearch','$idirectory','$referral','$yellow_pages','$trade','$other','$notes','$finalfile')") or die(mysql_error());


      }


      


      ?>

 

Link to comment
Share on other sites

RussellReal now I get this error

 

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Hawaii2008_0184646126.jpg' />')' at line 1

 

plus it may not always be an image that is uploaded.

Link to comment
Share on other sites

Instead of:

 

$finalfile.="<a href=".$Domain."/".$cdir."/".$name[count($name)-1]."><img src='".$name[count($name)-1]."' /></a>";

 

use:

 

$finalfile.="<a href=".$Domain."/".$cdir."/".$name[count($name)-1]."><img src=".$name[count($name)-1]." /></a>";

 

yours isn't valid html? :P

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.