Jump to content

[SOLVED] Writes link to email but not to database?


sandbudd

Recommended Posts

the code writes to the email and displays the upload link but will not write the link to the database?

 

<?php
error_reporting(0);
session_start();
$db_host = ''; 
$db_user = ''; 
$db_pwd = '';
$database = '';
$table = '';

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 = $_POST['customer'];
$company=$_POST['company'];
$address=$_POST['address'];
$city=$_POST['city'];
$zip_code=$_POST['zip_code'];
$email=$_POST['email'];
$phone=$_POST['phone'];
$fax=$_POST['fax'];
$type2=$_POST['type2'];
$type3=$_POST['type3'];
$burnishing=$_POST['burnish'];
$chromate=$_POST['chromate'];
$hex=$_POST['hex'];
$impregnation=$_POST['impregnation'];
$strip=$_POST['strip'];
$part=$_POST['part'];
$description=$_POST['description'];
$alloy=$_POST['alloy'];
$quantity=$_POST['quantity'];
$spec=$_POST['spec'];
$repeat_customer=$_POST['repeat_customer'];
$isearch=$_POST['isearch'];
$idirectory=$_POST['idirectory'];
$referral=$_POST['referral'];
$yellow_pages=$_POST['yellow_pages'];
$trade=$_POST['trade'];
$other=$_POST['other'];
$notes=$_POST['notes'];
$finalfile=$_POST['finalfile'];

mysql_query("INSERT INTO ae_gallery (finalfile,image1,image2,image3,image4,image5,image6,image7,image8,image9,image10,image11,image12,image13,image14,image15,image16,image17,image18,image19,image20,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,internet_directory,referral,yellow_pages,trade,other,notes) VALUES('$finalfile','$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','$internet_directory','$referral','$yellow_pages','$trade','$other','$notes')") or die(mysql_error());

$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.="<li><a href='".$Domain."/".$cdir."/".$name[count($name)-1]."'>".$name[count($name)-1]."</a></li>";
	$list_files.="<li>".$name[count($name)-1]."</li>";

}
}
}
///message in the mail//////
$msg="-- This is the Customer's information --
<br>Full Name: $customer 
<br>Company: $company
<br>Address: $address
<br>City: $city
<br>State: $State
<br>Zip: $zip
<br>Email: <a href='mailto:$email'>$email<a>
<br>Phone Number: $phone
<br>Fax Number: $fax
<br>Process Requested?
<br>$type2
$type3
$burnish
$chromate
$hex
$impregnation
$strip
<br>Part Number: $part_number
<br>Part Description: $part_description
<br>Alloy: $alloy
<br>Quantity: $quantity
<br>Specifications: $specifications
<br>Color: $color
<br>How did you hear about us? 
<br>Repeat: $repeat
<br>Internet Search: $internet_search
<br>Internet Directory: $internet_directory
<br>Referral: $referral
<br>Yellow Pages: $yellow_pages
<br>Trade Show: $trade_show
<br>Other: $other
<br>Notes: $notes

<br><br>Attached files: 
$finalfile";


///email address////
$to =  "mail@mail.com";

///Subject Title
$subject="New Message";

$headers = "From: $email\n" . "MIME-Version: 1.0\n" .
               "Content-type: text/html; charset=iso-8859-1";
   

//mail Function//////
mail($to,$subject,$msg,$headers);

?>

Link to comment
Share on other sites

also afther doing the lost inserts wouldnt be better to use the insert within the mail code..........


<?php
error_reporting(0);
session_start();
$db_host = ''; 
$db_user = ''; 
$db_pwd = '';
$database = '';
$table = '';

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 = $_POST['customer'];
$company=$_POST['company'];
$address=$_POST['address'];
$city=$_POST['city'];
$zip_code=$_POST['zip_code'];
$email=$_POST['email'];
$phone=$_POST['phone'];
$fax=$_POST['fax'];
$type2=$_POST['type2'];
$type3=$_POST['type3'];
$burnishing=$_POST['burnish'];
$chromate=$_POST['chromate'];
$hex=$_POST['hex'];
$impregnation=$_POST['impregnation'];
$strip=$_POST['strip'];
$part=$_POST['part'];
$description=$_POST['description'];
$alloy=$_POST['alloy'];
$quantity=$_POST['quantity'];
$spec=$_POST['spec'];
$repeat_customer=$_POST['repeat_customer'];
$isearch=$_POST['isearch'];
$idirectory=$_POST['idirectory'];
$referral=$_POST['referral'];
$yellow_pages=$_POST['yellow_pages'];
$trade=$_POST['trade'];
$other=$_POST['other'];
$notes=$_POST['notes'];
$finalfile=$_POST['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.="<li><a href='".$Domain."/".$cdir."/".$name[count($name)-1]."'>".$name[count($name)-1]."</a></li>";
	$list_files.="<li>".$name[count($name)-1]."</li>";

}
}
}
///message in the mail//////
$msg="-- This is the Customer's information --
<br>Full Name: $customer 
<br>Company: $company
<br>Address: $address
<br>City: $city
<br>State: $State
<br>Zip: $zip
<br>Email: <a href='mailto:$email'>$email<a>
<br>Phone Number: $phone
<br>Fax Number: $fax
<br>Process Requested?
<br>$type2
$type3
$burnish
$chromate
$hex
$impregnation
$strip
<br>Part Number: $part_number
<br>Part Description: $part_description
<br>Alloy: $alloy
<br>Quantity: $quantity
<br>Specifications: $specifications
<br>Color: $color
<br>How did you hear about us? 
<br>Repeat: $repeat
<br>Internet Search: $internet_search
<br>Internet Directory: $internet_directory
<br>Referral: $referral
<br>Yellow Pages: $yellow_pages
<br>Trade Show: $trade_show
<br>Other: $other
<br>Notes: $notes

<br><br>Attached files: 
$finalfile";


///email address////
$to =  "mail@mail.com";

///Subject Title
$subject="New Message";

$headers = "From: $email\n" . "MIME-Version: 1.0\n" .
               "Content-type: text/html; charset=iso-8859-1";
   

//mail Function//////
if(mail($to,$subject,$msg,$headers)){

mysql_query("INSERT INTO ae_gallery (finalfile,image1,image2,image3,image4,image5,image6,image7,image8,image9,image10,image11,image12,image13,image14,image15,image16,image17,image18,image19,image20,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,internet_directory,referral,yellow_pages,trade,other,notes) VALUES('$finalfile','$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','$internet_directory','$referral','$yellow_pages','$trade','$other','$notes')") or die(mysql_error());
}

?>

Link to comment
Share on other sites

this actually the way the code is sorry I posted an older one...my bad. Ken2k7 all images field?

 

<?php
error_reporting(0);
session_start();
$db_host = ''; 
$db_user = ''; 
$db_pwd = '';
$database = '';
$table = '';

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 = $_POST['customer'];
$company=$_POST['company'];
$address=$_POST['address'];
$city=$_POST['city'];
$zip_code=$_POST['zip_code'];
$email=$_POST['email'];
$phone=$_POST['phone'];
$fax=$_POST['fax'];
$type2=$_POST['type2'];
$type3=$_POST['type3'];
$burnishing=$_POST['burnish'];
$chromate=$_POST['chromate'];
$hex=$_POST['hex'];
$impregnation=$_POST['impregnation'];
$strip=$_POST['strip'];
$part=$_POST['part'];
$description=$_POST['description'];
$alloy=$_POST['alloy'];
$quantity=$_POST['quantity'];
$spec=$_POST['spec'];
$repeat_customer=$_POST['repeat_customer'];
$isearch=$_POST['isearch'];
$idirectory=$_POST['idirectory'];
$referral=$_POST['referral'];
$yellow_pages=$_POST['yellow_pages'];
$trade=$_POST['trade'];
$other=$_POST['other'];
$notes=$_POST['notes'];
$finalfile=$_POST['finalfile'];

mysql_query("INSERT INTO ae_gallery (finalfile,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,internet_directory,referral,yellow_pages,trade,other,notes) VALUES('$finalfile','$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','$internet_directory','$referral','$yellow_pages','$trade','$other','$notes')") or die(mysql_error());

$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.="<li><a href='".$Domain."/".$cdir."/".$name[count($name)-1]."'>".$name[count($name)-1]."</a></li>";
	$list_files.="<li>".$name[count($name)-1]."</li>";

}
}
}
///message in the mail//////
$msg="-- This is the Customer's information --
<br>Full Name: $customer 
<br>Company: $company
<br>Address: $address
<br>City: $city
<br>State: $State
<br>Zip: $zip
<br>Email: <a href='mailto:$email'>$email<a>
<br>Phone Number: $phone
<br>Fax Number: $fax
<br>Process Requested?
<br>$type2
$type3
$burnish
$chromate
$hex
$impregnation
$strip
<br>Part Number: $part_number
<br>Part Description: $part_description
<br>Alloy: $alloy
<br>Quantity: $quantity
<br>Specifications: $specifications
<br>Color: $color
<br>How did you hear about us? 
<br>Repeat: $repeat
<br>Internet Search: $internet_search
<br>Internet Directory: $internet_directory
<br>Referral: $referral
<br>Yellow Pages: $yellow_pages
<br>Trade Show: $trade_show
<br>Other: $other
<br>Notes: $notes

<br><br>Attached files: 
$finalfile";


///email address////
$to =  "mail@mail.com";

///Subject Title
$subject="New Message";

$headers = "From: $email\n" . "MIME-Version: 1.0\n" .
               "Content-type: text/html; charset=iso-8859-1";
   

//mail Function//////
mail($to,$subject,$msg,$headers);

?>

Link to comment
Share on other sites

im sure it needs it this way

 

 

//mail Function//////
if(mail($to,$subject,$msg,$headers)){

mysql_query("INSERT INTO ae_gallery (finalfile,image1,image2,image3,image4,image5,image6,image7,image8,image9,image10,image11,image12,image13,image14,image15,image16,image17,image18,image19,image20,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,internet_directory,referral,yellow_pages,trade,other,notes) VALUES('$finalfile','$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','$internet_directory','$referral','$yellow_pages','$trade','$other','$notes')") or die(mysql_error());
}

Link to comment
Share on other sites

Changed to this and got the same results

Thanks for all the help

 

<?php
error_reporting(0);
session_start();
$db_host = ''; 
$db_user = ''; 
$db_pwd = '';
$database = '';
$table = '';

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 = $_POST['customer'];
$company=$_POST['company'];
$address=$_POST['address'];
$city=$_POST['city'];
$zip_code=$_POST['zip_code'];
$email=$_POST['email'];
$phone=$_POST['phone'];
$fax=$_POST['fax'];
$type2=$_POST['type2'];
$type3=$_POST['type3'];
$burnishing=$_POST['burnish'];
$chromate=$_POST['chromate'];
$hex=$_POST['hex'];
$impregnation=$_POST['impregnation'];
$strip=$_POST['strip'];
$part=$_POST['part'];
$description=$_POST['description'];
$alloy=$_POST['alloy'];
$quantity=$_POST['quantity'];
$spec=$_POST['spec'];
$repeat_customer=$_POST['repeat_customer'];
$isearch=$_POST['isearch'];
$idirectory=$_POST['idirectory'];
$referral=$_POST['referral'];
$yellow_pages=$_POST['yellow_pages'];
$trade=$_POST['trade'];
$other=$_POST['other'];
$notes=$_POST['notes'];
$finalfile=$_POST['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.="<li><a href='".$Domain."/".$cdir."/".$name[count($name)-1]."'>".$name[count($name)-1]."</a></li>";
	$list_files.="<li>".$name[count($name)-1]."</li>";

}
}
}
///message in the mail//////
$msg="-- This is the Customer's information --
<br>Full Name: $customer 
<br>Company: $company
<br>Address: $address
<br>City: $city
<br>State: $State
<br>Zip: $zip
<br>Email: <a href='mailto:$email'>$email<a>
<br>Phone Number: $phone
<br>Fax Number: $fax
<br>Process Requested?
<br>$type2
$type3
$burnish
$chromate
$hex
$impregnation
$strip
<br>Part Number: $part_number
<br>Part Description: $part_description
<br>Alloy: $alloy
<br>Quantity: $quantity
<br>Specifications: $specifications
<br>Color: $color
<br>How did you hear about us? 
<br>Repeat: $repeat
<br>Internet Search: $internet_search
<br>Internet Directory: $internet_directory
<br>Referral: $referral
<br>Yellow Pages: $yellow_pages
<br>Trade Show: $trade_show
<br>Other: $other
<br>Notes: $notes

<br><br>Attached files: 
$finalfile";


///email address////
$to =  "mail@mail.com";

///Subject Title
$subject="New Message";

$headers = "From: $email\n" . "MIME-Version: 1.0\n" .
               "Content-type: text/html; charset=iso-8859-1";
   

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

mysql_query("INSERT INTO ae_gallery (finalfile,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,internet_directory,referral,yellow_pages,trade,other,notes) VALUES('$finalfile','$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','$internet_directory','$referral','$yellow_pages','$trade','$other','$notes')") or die(mysql_error());
}

?>

Link to comment
Share on other sites

redarrow changed to this and get the same thing?

 

<?php
error_reporting(0);
session_start();
$db_host = ''; 
$db_user = ''; 
$db_pwd = '';
$database = '';
$table = '';

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']);
$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']);
$burnishing=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=$_POST['alloy'];
$quantity=mysql_real_escape_string($_POST['quantity']);
$spec=mysql_real_escape_string($_POST['spec']);
$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($_POST['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.="<li><a href='".$Domain."/".$cdir."/".$name[count($name)-1]."'>".$name[count($name)-1]."</a></li>";
	$list_files.="<li>".$name[count($name)-1]."</li>";

}
}
}
///message in the mail//////
$msg="-- This is the Customer's information --
<br>Full Name: $customer 
<br>Company: $company
<br>Address: $address
<br>City: $city
<br>State: $State
<br>Zip: $zip
<br>Email: <a href='mailto:$email'>$email<a>
<br>Phone Number: $phone
<br>Fax Number: $fax
<br>Process Requested?
<br>$type2
$type3
$burnish
$chromate
$hex
$impregnation
$strip
<br>Part Number: $part_number
<br>Part Description: $part_description
<br>Alloy: $alloy
<br>Quantity: $quantity
<br>Specifications: $specifications
<br>Color: $color
<br>How did you hear about us? 
<br>Repeat: $repeat
<br>Internet Search: $internet_search
<br>Internet Directory: $internet_directory
<br>Referral: $referral
<br>Yellow Pages: $yellow_pages
<br>Trade Show: $trade_show
<br>Other: $other
<br>Notes: $notes

<br><br>Attached files: 
$finalfile";


///email address////
$to =  "mail@mail.com";

///Subject Title
$subject="New Message";

$headers = "From: $email\n" . "MIME-Version: 1.0\n" .
               "Content-type: text/html; charset=iso-8859-1";
   

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

mysql_query("INSERT INTO ae_gallery (finalfile,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,internet_directory,referral,yellow_pages,trade,other,notes) VALUES('$finalfile','$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','$internet_directory','$referral','$yellow_pages','$trade','$other','$notes')") or die(mysql_error());
}

?>

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.