Jump to content

Ashish Sood

Members
  • Posts

    79
  • Joined

  • Last visited

Posts posted by Ashish Sood

  1. Hi,

     

    I am working on the project where i need to display the user profile in the table format everything is working except the alignment of textarea.

    if(isset($_POST['submit'])){	$search = $_POST["search"];	include("../../../../../../../inetpub/wwwroot/dbcon/connection.php");	$selectdb=mysql_select_db("mid_federick",$con);		//select condition with joinning	$selectcondition="select order_dayshiftchecklist.DATE,checklist_dayshiftjob.JOBNAME,checklist_dayshiftjob.TIME,order_dayshiftchecklist.INITIALS FROM order_dayshiftchecklist,checklist_dayshiftjob  where order_dayshiftchecklist.JOB=checklist_dayshiftjob.JOB && DATE='".$search."'";		$check=mysql_query($selectcondition,$con);	$fetch=mysql_fetch_row($check);	//if zero result found	if(!$fetch)            				 	{		echo "<font color='red'>";		echo "<br>";		echo "<b>No details found of requested $date</b>"; 		echo "<br>";	    echo "</font>";	}	//if result found 	else	{				$selectcondition1="select order_dayshiftchecklist.DATE,checklist_dayshiftjob.JOBNAME,checklist_dayshiftjob.TIME,order_dayshiftchecklist.INITIALS FROM order_dayshiftchecklist,checklist_dayshiftjob  where order_dayshiftchecklist.JOB=checklist_dayshiftjob.JOB && DATE='".$search."'";		$check1=mysql_query($selectcondition1,$con);				$comment= "select COMMENTS,DATE from comments where DATE='".$_POST['search']."'";		$my_comments=mysql_query($comment,$con);				echo "<table class='mytable' width='100%' border='1' cellspacing='0'>        <tr>        <th width='10%'>DATE</th>		<th width='5%'>TIME</th>        <th width='30%'>ORDER</th>        <th width='60%'>INITIALS</th>        </tr>";         		while($records = mysql_fetch_array($check1))         	 	{			echo "<tr>";			echo "<td>" . $records['DATE'] . " </td>";			echo "<td>" . $records['TIME']. " </td>";			echo "<td><pre>" . $records['ORDER']. " </td>";			echo  '<textarea name="initials" cols="20" rows="2" disable="disable">'.$records['INITIALS'].'</textarea><br />';		}					$records_comments = mysql_fetch_array($my_comments);       	    echo "<h4>COMMENTS</h4>";	   	    echo "<br>";		echo  '<textarea name="comments" cols="50" rows="10" disable="disable">'.$records_comments['COMMENTS'].'</textarea><br ><br />'; 			    }	}	?>

    Why the initials & comments textarea show at the top the the webpage

     

    I want initials to show in the table row

    And comments textarea to show at the bottom of the page.

     

  2. Hi All,I am on the project of email attachment where i am facing some strange problem, my email attachment is working fine when i upload my php script to my personal hosting server, but when i test the similar php script inside of my company network the attachment arrived in the corrupt form, i don't know where is the problem and how to fix it .

    <html><head><title>Sending attachment using PHP</title></head><body>    <?php //echo dirname(__FILE__); ?><?php$max_allowed_file_size = 10000000; // size in KB$allowed_extensions = array("jpg", "jpeg", "gif", "bmp", "doc", "docx");$upload_folder = 'upload/'; //<-- this folder must be writeable by the script$your_email = 'test@abc.com';//<<-- update this to your email address$errors ='';//Get the uploaded file information    $name_of_uploaded_file = basename($_FILES['attachment']['name']);        //get the file extension of the file    $type_of_uploaded_file = substr($name_of_uploaded_file,                            strrpos($name_of_uploaded_file, '.') + 1);        $size_of_uploaded_file = $_FILES["attachment"]["size"]/1024;        ///------------Do Validations-------------    /*if(empty($_POST['name'])||empty($_POST['email']))    {        $errors .= "n Name and Email are required fields. ";        }*/    /*if(IsInjected($visitor_email))    {        $errors .= "n Bad email value!";    }*/        if($size_of_uploaded_file > $max_allowed_file_size )    {        $errors .= "n Size of file should be less than $max_allowed_file_size";    }        //------ Validate the file extension -----    $allowed_ext = false;    for($i=0; $i<sizeof($allowed_extensions); $i++)    {        if(strcasecmp($allowed_extensions[$i],$type_of_uploaded_file) == 0)        {            $allowed_ext = true;                }    }        if(!$allowed_ext)    {        $errors .= "n The uploaded file is not supported file type. ".        " Only the following file types are supported: ".implode(',',$allowed_extensions);    }        //send the email    if(empty($errors))    {        //copy the temp. uploaded file to uploads folder        $path_of_uploaded_file = $upload_folder . $name_of_uploaded_file;        $tmp_path = $_FILES["attachment"]["tmp_name"];                if(is_uploaded_file($tmp_path))        {         if(!copy($tmp_path,$path_of_uploaded_file))         {             $errors .= 'n error while copying the uploaded file';         }        }$to = "test@xyz.com";$subject = "Testing";$message = htmlspecialchars($_POST['comments']);# Open a file$file = fopen( "upload/".$name_of_uploaded_file, "r" );if( $file == false ){echo "Error in opening file";exit();}# Read the file into a variable$size = filesize("upload/".$name_of_uploaded_file);$content = fread( $file, $size);fclose($file);# encode the data for safe transit# and insert rn after every 76 chars.$encoded_content = chunk_split(base64_encode($content));# Get a random 32 bit number using time() as seed.$num = md5( time() );# Define the main headers.$header = "From:$your_emailrn";$header .= "MIME-Version: 1.0rn";$header .= "Content-Type: multipart/mixed; ";$header .= "boundary=$numrn";$header .= "--$numrn";# Define the message section$header .= "Content-Type: text/plainrn";$header .= "Content-Transfer-Encoding:8bitrnn";$header .= "$messagern";$header .= "--$numrn";# Define the attachment section$header .= "Content-Type: multipart/mixed; ";$header .= "name="$name_of_uploaded_file"rn";$header .= "Content-Transfer-Encoding:base64rn";$header .= "Content-Disposition:attachment; ";$header .= "filename="$name_of_uploaded_file"rnn";$header .= "$encoded_contentrn";$header .= "--$num--";# Send email now$retval = mail ( $to, $subject, $message, $header );if( $retval == true ){echo "Messageaahh sent successfully...";}else{echo "Message could not be sent...";}}?></body></html>
  3. Hi ,

     

    I have created a php script which can send a attachment with mail but i want to give browse option to user so that they can choose the file which they want to send but i don't know to render this function with php email script

     

    I have created front end and sample email script. hope you understand my requirement .

     

    [Front end]

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta content="text/html; charset=utf-8" http-equiv="Content-Type" /><title>Email testing </title></head><body><form method="post" action="back.php" enctype="multipart/form-data">Incoming :<input name="incoming" type="text" />Outgoing :<input name="outgoing" type="text" />Comments :<textarea name="comments" cols="20" rows="2"></textarea><input name="attachment" type="file" style="width: 216px; height: 26px" /><br /><br /><input name="submit" type="submit" value="Submit" /></form></body></html>

    My Sample email script which sends defined attachement.

    <html><head><title>Sending attachment using PHP</title></head><body><?php  $to = "sample@abc.com";  $subject = "offer letter";  $message = "This is test message.";  # Open a file  $file = fopen( "upload/test.txt", "r" );  if( $file == false )  {     echo "Error in opening file";     exit();  }  # Read the file into a variable  $size = filesize("upload/test.txt");  $content = fread( $file, $size);  fclose($file);  # encode the data for safe transit  # and insert rn after every 76 chars.  $encoded_content = chunk_split(base64_encode($content));    # Get a random 32 bit number using time() as seed.  $num = md5( time() );  # Define the main headers.  $header = "From:testing@sample.comrn";  $header .= "MIME-Version: 1.0rn";  $header .= "Content-Type: multipart/mixed; ";  $header .= "boundary=$numrn";  $header .= "--$numrn";  # Define the message section  $header .= "Content-Type: text/plainrn";  $header .= "Content-Transfer-Encoding:8bitrnn";  $header .= "$messagern";  $header .= "--$numrn";  # Define the attachment section  $header .= "Content-Type:  multipart/mixed; ";  $header .= "name="test.txt"rn";  $header .= "Content-Transfer-Encoding:base64rn";  $header .= "Content-Disposition:attachment; ";  $header .= "filename="test.txt"rnn";  $header .= "$encoded_contentrn";  $header .= "--$num--";  # Send email now  $retval = mail ( $to, $subject, $message, $header );  if( $retval == true )   {      echo "Messageaahh sent successfully...";   }   else   {      echo "Message could not be sent...";   }?></body></html>

    Please reply me soon

     

    Thanks....

     

     

  4. @Don this is what i did so far with my script , after that its not sending any mail with attachment.

    //Get the uploaded file information				$name_of_uploaded_file =  basename($_FILES['uploaded_file']['name']);					//get the file extension of the file				$type_of_uploaded_file = substr($name_of_uploaded_file, 				strrpos($name_of_uploaded_file, '.') + 1);							    $size_of_uploaded_file = $_FILES["uploaded_file"]["size"]/1024;				$allowed_ext = false;				for($i=0; $i<sizeof($allowed_extensions); $i++) 				{ 					if(strcasecmp($allowed_extensions[$i],$type_of_uploaded_file) == 0)					{						$allowed_ext = true;							}				}					if(!$allowed_ext)				{					$errors .= "n The uploaded file is not supported file type. ".					" Only the following file types are supported: ".implode(',',$allowed_extensions);				}				//send the email 				if(empty($errors))				{					//copy the temp. uploaded file to uploads folder					$path_of_uploaded_file = $upload_folder . $name_of_uploaded_file;					$tmp_path = $_FILES["uploaded_file"]["tmp_name"];					if(is_uploaded_file($tmp_path))					{						if(!copy($tmp_path,$path_of_uploaded_file))						{							$errors .= 'n error while copying the uploaded file';						}					}									$from="REPORT@abc.com";				$to="xyz@abc.com";				$subject="Midrange|Testing of $date";										$header .= "From: {$from}rn"; 				$header .= "Reply-To: {$to}rn"; 				$header .= "Return-path: " . $to;								$filename = $name_of_uploaded_file;				$message ="Please find the link of ";								$file_size = $size_of_uploaded_file;				$content = chunk_split(base64_encode(file_get_contents('http://x.x.x.x/dummy/upload/'.$name_of_uploaded_file))); 				$uid = md5(uniqid(time()));				$from = str_replace(array("r", "n"), '', $from); // to prevent email injection	  	  	  $header = "From: ".$from."rn"		  ."MIME-Version: 1.0rn"		  ."Content-Type: multipart/mixed; boundary="".$uid.""rnrn"		  ."This is a multi-part message in MIME format.rn" 		  ."--".$uid."rn"		  ."Content-type:text/plain; charset=iso-8859-1rn"		  ."Content-Transfer-Encoding: 7bitrnrn"		  .$message."rnrn"		  ."--".$uid."rn"		  ."Content-Type: application/octet-stream; name="".$filename.""rn"		  ."Content-Transfer-Encoding: base64rn"		  ."Content-Disposition: attachment; filename="".$filename.""rnrn"		  .$content."rnrn"		  ."--".$uid."--";		mail( $to,  $subject, $message, $header, "-f{$from}"); 	}
  5. @Don, before adding changes to my original script which already runs in production i want to test it by my own if everything is ok then i will move my modification into production environment .

     

    So above i had posted my email script which is replica of production one, except the message,subject variable.

     

    I just want to know what i need to add so that i can send email with attachment.

     

     

    Thanks for the reply

  6. Hi Everyone,

     

    I am working on the email part of my project , i don't have any issue regarding sending a text email but i added the feature of attachment now it like the send emails with attachment i read lots of online tutorial for email attachment but none of them help me out. :Sad:

     

     

    my_code.php

    <html xmlns="http://www.w3.org/1999/xhtml"><head><meta content="text/html; charset=utf-8" http-equiv="Content-Type" /><title>email</title></head><body><form action="" method="post"><input type="text" name="name" /><br/><br/><input name="File1" type="file" /><p><input name="submit" type="submit" value="submit" /></p></form></body></html>

    email_inc.php

    if(isset($_POST['submit'])) {$header = 'MIME-Version: 1.0' . "rn";						$header .= 'Content-type: text/html; charset=iso-8859-1' . "rn";									$header .= "From: {$from}rn"; 						$header .= "Reply-To: {$to}rn"; 						$header .= "Return-path: " . $to; 		   						mail( $to,  $subject, $message, $header, "-f{$from}"); }

    Above script is for simple email without attachment, Please help me out what to do for attachment emails.

     

     

    Thanks In Advance

     

  7. I have corrected the code but now error comes in. please find the below code

    <?php       require_once("dompdf/dompdf_config.inc.php");    function content(){        $content="";    if(isset($_POST['submit']))    {            include("../../../../../../../inetpub/wwwroot/dbcon/connection.php");     $content .=  "<h3>ORDER STATUS</h3>";     $search=htmlspecialchars($_POST['search']);     $selectcondition = "SELECT * FROM customer.order where DATE='".$search."'"; //Select Query Which check the whether the TURNOVER for the given INCIDENT is exit or not.     $check=mysql_query($selectcondition,$con);     $fetch=mysql_fetch_row($check);    if(!$fetch)                            //If checklist for the given date is not exit execute if condition    {      $content .=   "<font color='red'>";      $content .=      "<br>";      $content .=  "No Order Found In The Database";      $content .=  "<br>";      $content .=   "</font>";       return $content;    }         else //if the above condition is flase !          {              $sql= "select * from customer.order where DATE='".$_POST['search']."'";                     $mydata=mysql_query($sql,$con);        //$fetch_rows=mysql_fetch_row($mydata);                 $content .=  "<table class='mytable' width='100%' height='10%' border='1' cellspacing='0'>                                   <tr>                      <th>DATE</th>                      <th>ORDER</th>                      <th>CUSTNAME</th>                      <th>COMMENTS</th>                                                 </tr>";                        while($records = mysql_fetch_array($mydata))                        {                            $content .=    "<tr>";                $content .=           "<td>" . $records['TIMESTAMPS'] . " </td>";                $content .=           "<td>" . $records['ORDER']. " </td>";                $content .=           "<td>" . $records['CUSTNAME'] . " </td>";                $content .=          "<td align='center'>";                $content .=          '<textarea  name="textarea" cols="100"  >'.$records['COMMENTS'].'</textarea><br>';                $content .=  "</td>";            }                                      $content .="</table>";            return $content;                            }        }  }  $html= content();  if($html){      $dompdf = new DOMPDF();      $dompdf->load_html($html);      $dompdf->render();      $dompdf->stream("order.pdf");  }else{    echo "Look like something is wrong here .";  } ?>

    After making the changes, A corrupted pdf file is generated.

  8. Hi all

     

    I am trying to fetch my table content into an PDF, But getting error message.

     

     

    Error message

    Fatal error: Uncaught exception 'DOMPDF_Exception' with message 'Requested HTML document contains no data.' in C:xampphtdocsprojectsampleofficedompdfincludeframe_tree.cls.php:135 Stack trace: #0 C:xampphtdocsprojectsampleofficedompdfincludedompdf.cls.php(293): Frame_Tree->build_tree() #1 C:xampphtdocsprojectsampleofficedompdfincludedompdf.cls.php(377): DOMPDF->_process_html() #2 C:xampphtdocsprojectsampleofficedom.php(236): DOMPDF->render() #3 {main} thrown in C:xampphtdocsprojectsampleofficedompdfincludeframe_tree.cls.php on line 135

    my PHPscript

    <html><body><input type=text name=search ><span class="error"> <?php echo $error;?></span><br><input type=submit name=submit value=Search></form></body></html><?phprequire_once("dompdf/dompdf_config.inc.php");   $date=date("m/d/Y");   echo "Today Date Is = ";   echo "$date";   echo "<h1><center>Midrange, Turnover For All The Accounts </center></h3>";			include("../../../../../../../inetpub/wwwroot/dbcon/connection.php");   	function content(){		    if(isset($_POST['submit']))    {			include("../../../../../../../inetpub/wwwroot/dbcon/connection.php");	 echo "<h3>Turnover For Apria</h3>";	 $search=htmlspecialchars($_POST['search']);     $selectcondition = "SELECT * FROM customer.order where DATE='".$search."'"; //Select Query Which check the whether the TURNOVER for the given INCIDENT is exit or not.     $check=mysql_query($selectcondition,$con);     $fetch=mysql_fetch_row($check); 	if(!$fetch)            				//If checklist for the given date is not exit execute if condition 	{        echo "<font color='red'>";		echo "<br>";		echo "No records Found In The Database"; 		echo "<br>";        echo "</font>";	}		 else //if the above condition is flase !          {     	 	$sql= "select * from customer.order where DATE='".$_POST['search']."'";         	        $mydata=mysql_query($sql,$con);		//$fetch_rows=mysql_fetch_row($mydata);				 echo "<table class='mytable' width='100%' height='10%' border='1' cellspacing='0'>              			         <tr>	                  <th>DATE</th>	                  <th>ORDER</th>	                  <th>SUTNAME</th>	                  <th> COMMENTS</th>			                            		 </tr>";					while($records = mysql_fetch_array($mydata))         	 	{			            echo "<tr>";            		echo "<td>" . $records['TIMESTAMPS'] . " </td>";            		echo "<td>" . $records['ORDER']. " </td>";            		echo "<td>" . $records['CUSTNAME'] . " </td>";            	    echo "<td align='center'>";					echo '<textarea  name="textarea" cols="100"  >'.$records['COMMENTS'].'</textarea><br>'; 			echo "</td>";  		}		  	}			echo "</table>";						}  $html=content();  $dompdf = new DOMPDF();  $dompdf->load_html($html);  $dompdf->render();  $dompdf->stream("order.pdf");  ?>	

    Please tell me what sort of changes i need to do into my current script.

     

    Thanks,

    Ashish

     

  9. Hi All,

     

     

    I am using FPDF library, to generate a PDF document, its is my first time i am using it. but getting a error while generating the PDF document.

    Notice: Array to string conversion in C:inetpubwwwrootcustomersfpdffpdf.php on line 656FPDF error: Some data has already been output, can't send PDF file

    My requirements,

     

    I want to fetch a details on per days basis from my table, for that i have created a textbox and button , in which user can entered the date and as per the date i want to generate a PDF file.

     

    My Code

    <html><body><p>MM/DD/YYYY</p><form action="" method="post">  <input type=text name=search >               //Textbox<input type="submit" name="submit" value="Fetch Report">  //fetch Report button</form></body></html><?phprequire ('fpdf/fpdf.php');$date=date("m/d/Y");                              //Assigning Date to date variableecho "<br>";echo "Today's Date Is = $date";include("../../../../../../../inetpub/wwwroot/dbcon/connection.php");$selectdb=mysql_select_db("customer",$con);if(!$selectdb){      die ("Database Connection Error" .mysql_error());}if(isset($_POST['submit'])){         $selectcondition = "SELECT * from orders_details where DATE='".$_POST['search']."'";     $mydata=mysql_query($selectcondition,$con);     $row=mysql_fetch_assoc($mydata);              $pdf = new FPDF();     $pdf->addPage();     $pdf->SetFont('Arial','B',16);     $pdf->Cell(40,10,$row);     $pdf -> output();    }?>

    Please let me know what sort of changes i need to add into it.

     

     

    Thanks

    Ashish

  10. Unable to format the data which is inside of loop, Any help

    while($records = mysql_fetch_array($check))								    {																					$order .= 'record for user ' . $records['TIMESTAMPS'] . '<br>';											$order .= 'record for user ' . $records['ORDERID'] . '<br>';											$order .= 'record for user ' . $records['ORDERNUM'] . '<br>';											$order .= 'record for user ' . $records['SATUS'] . '<br>';									    	$order .= 'record for user ' . $records['COMMENTS'] . '<br>';									 }

    Please Reply me ASAP

  11. Sorry for replying late, i was out of town,

    I have changed the variable message => order , But still no order detail coming with mail, Except only the "order description" text

    $order = Order DESCRIPTION';								   while($records = mysql_fetch_array($check))								    {																					$order .= 'record for user ' . $records['TIMESTAMPS'] . '<br>';											$order .= 'record for user ' . $records['ORDERID'] . '<br>';											$order .= 'record for user ' . $records['ORDERNUM'] . '<br>';											$order .= 'record for user ' . $records['SATUS'] . '<br>';									    	$order .= 'record for user ' . $records['COMMENTS'] . '<br>';									 }$order.= 'END';	            								$message ="<html><body><hr>								   <p> <strong><font color ='#69571F'><em>First</em></font></strong> =><font color ='#858685'> {$first}</font></p><p> <strong><font color ='#69571F'><em>Last</em></font></strong> =><font color ='#858685'> {$last}</font></p><p> <strong><font color ='#69571F'><em>Comments </em></font></strong> =><font color ='#858685'> {$comments}</font></p>								   								 																		   <hr></body></html>";								   $header = 'MIME-Version: 1.0' . "rn";$header .= 'Content-type: text/html; charset=iso-8859-1' . "rn";			$header .= "From: {$from}rn"; $header .= "Reply-To: {$to}rn"; $header .= "Return-path: " . $to; 		   												 mail( $to,  $subject, $message. $order, $header, "-f{$from}"); }	
  12. Thanks, I understood the problem , i have made the changes into my code after that i able to overcome from the problem, But still order details will not come along with that mail ? simply customer details are coming along with the mail .

    <?phpif(isset($_POST['submit_shift'])){			include("../../../../../../../inetpub/wwwroot/dbcon/connection.php");			$selectdb=mysql_select_db("customer",$con);   			if(!$selectdb)			{				die ("Database Connection Error" .mysql_error());			}						$outgoing= htmlspecialchars($_POST['outgoing']);			$incoming= htmlspecialchars($_POST['incoming']);	 		$comments= htmlspecialchars($_POST['shift_comments']);						if (!preg_match('/^[a-zA-Z0-9ds.]*$/', $outgoing . $incoming . $comments))			{				$turnmsg = "<b><font color='red'> Only letters,spaces,decimal & .  are allowed </font></b>";			}						else			{							$sql = mysql_query("INSERT INTO customer (DATE,FIRST,LAST,COMMENTS) VALUES('$date','$FIRST','$LAST','$comments')")				or die ("Database Connection Error" .mysql_error());						$turnmsg = "<br><b> <font color='green'>THANKS FOR REGISTRATION</b></font>";								        															       $selectcondition = "SELECT * FROM order_detail where DATE='".$date."'";							$check=mysql_query($selectcondition,$con);						$fetch=mysql_fetch_row($check);																									$from="REPORT@abc.com";                                                $to="admin@abc.com";                                                $subject="Customer report of $date";                                                                                                                                      $message = 'Order Details';								    while($records = mysql_fetch_array($fetch))                                                                     {                                                                                                                           $message .= 'record for user ' . $records['TIMESTAMPS'] . '<br>';                                                                                   $message .= 'record for user ' . $records['ORDERID'] . '<br>';                                                                                   $message .= 'record for user ' . $records['ORDERNUM'] . '<br>';                                                                                   $message .= 'record for user ' . $records['STATUS'] . '<br>';                                                                                   $message .= 'record for user ' . $records['COMMENTS'] . '<br>';                                    									}																		$message .= 'END';	            														$message ="<html>								   <body>								   <hr>								   								   <p> <strong><font color ='#69571F'><em>First</em></font></strong> =><font color ='#858685'> {$first}</font></p>								   <p> <strong><font color ='#69571F'><em>Last</em></font></strong> =><font color ='#858685'> {$last}</font></p>								   <p> <strong><font color ='#69571F'><em>Comments </em></font></strong> =><font color ='#858685'> {$comments}</font></p>								   								 																		   								   <hr>								   </body>								   </html>";								   						$header = 'MIME-Version: 1.0' . "rn";						$header .= 'Content-type: text/html; charset=iso-8859-1' . "rn";									$header .= "From: {$from}rn"; 						$header .= "Reply-To: {$to}rn"; 						$header .= "Return-path: " . $to; 		   												//mail($to, $subject, $message,"From:".$from, "-f$from");						 						mail( $to,  $subject, $message, $header, "-f{$from}"); 			}	?>
  13. <?phpif(isset($_POST['submit_shift'])){			include("../../../../../../../inetpub/wwwroot/dbcon/connection.php");			$selectdb=mysql_select_db("customer",$con);   			if(!$selectdb)			{				die ("Database Connection Error" .mysql_error());			}						$outgoing= htmlspecialchars($_POST['outgoing']);			$incoming= htmlspecialchars($_POST['incoming']);	 		$comments= htmlspecialchars($_POST['shift_comments']);						if (!preg_match('/^[a-zA-Z0-9ds.]*$/', $outgoing . $incoming . $comments))			{				$turnmsg = "<b><font color='red'> Only letters,spaces,decimal & .  are allowed </font></b>";			}						else			{							$sql = mysql_query("INSERT INTO customer (DATE,FIRST,LAST,COMMENTS) VALUES('$date','$FIRST','$LAST','$comments')")				or die ("Database Connection Error" .mysql_error());						$turnmsg = "<br><b> <font color='green'>THANKS FOR REGISTRATION</b></font>";								        															    $selectcondition = "SELECT * FROM order_detail where DATE='".$date."'";							$check=mysql_query($selectcondition,$con);						$fetch=mysql_fetch_row($check);																									$from="REPORT@abc.com";                        $to="admin@abc.com";                        $subject="Customer report of $date";	            														$message ="<html>								   <body>								   <hr>								   								   <p> <strong><font color ='#69571F'><em>First</em></font></strong> =><font color ='#858685'> {$first}</font></p>								   <p> <strong><font color ='#69571F'><em>Last</em></font></strong> =><font color ='#858685'> {$last}</font></p>								   <p> <strong><font color ='#69571F'><em>Comments </em></font></strong> =><font color ='#858685'> {$comments}</font></p>								   								    $message = 'Order Details';								    while($records = mysql_fetch_array($fetch))                                    {                                                                                $message .= 'record for user ' . $records['TIMESTAMPS'] . '<br>';                                        $message .= 'record for user ' . $records['ORDERID'] . '<br>';                                        $message .= 'record for user ' . $records['ORDERNUM'] . '<br>';                                        $message .= 'record for user ' . $records['STATUS'] . '<br>';                                        $message .= 'record for user ' . $records['COMMENTS'] . '<br>';                                    									}																		$message .= 'END';																		   								   <hr>								   </body>								   </html>";								   						$header = 'MIME-Version: 1.0' . "rn";						$header .= 'Content-type: text/html; charset=iso-8859-1' . "rn";									$header .= "From: {$from}rn"; 						$header .= "Reply-To: {$to}rn"; 						$header .= "Return-path: " . $to; 		   												//mail($to, $subject, $message,"From:".$from, "-f$from");						 						mail( $to,  $subject, $message, $header, "-f{$from}"); 			}	?>
  14. Still having the same error

                                                                       $message = 'Order Details';								  while($records = mysql_fetch_array($fetch))                                                                  {                                                                                                               $message .= 'record for user ' . $records['TIMESTAMPS'] . '<br>';                                                                       $message .= 'record for user ' . $records['ORDERID'] . '<br>';                                                                       $message .= 'record for user ' . $records['ORDERNUM'] . '<br>';                                                                       $message .= 'record for user ' . $records['STATUS'] . '<br>';                                                                       $message .= 'record for user ' . $records['COMMENTS'] . '<br>';                                                                   }																		$message .= 'END';
  15. Yes you are right , how could i overcome from it ? Below is my complete code

    <?phpif(isset($_POST['submit_shift'])){			include("../../../../../../../inetpub/wwwroot/dbcon/connection.php");			$selectdb=mysql_select_db("customer",$con);   			if(!$selectdb)			{				die ("Database Connection Error" .mysql_error());			}						$outgoing= htmlspecialchars($_POST['outgoing']);			$incoming= htmlspecialchars($_POST['incoming']);	 		$comments= htmlspecialchars($_POST['shift_comments']);						if (!preg_match('/^[a-zA-Z0-9ds.]*$/', $outgoing . $incoming . $comments))			{				$turnmsg = "<b><font color='red'> Only letters,spaces,decimal & .  are allowed </font></b>";			}						else			{							$sql = mysql_query("INSERT INTO customer (DATE,FIRST,LAST,COMMENTS) VALUES('$date','$FIRST','$LAST','$comments')")				or die ("Database Connection Error" .mysql_error());						$turnmsg = "<br><b> <font color='green'>THANKS FOR REGISTRATION</b></font>";								        															    $selectcondition = "SELECT * FROM order_detail where DATE='".$date."'";							$check=mysql_query($selectcondition,$con);						$fetch=mysql_fetch_row($check);																																								$from="REPORT@abc.com";                        $to="admin@abc.com";                        $subject="Customer report of $date";	            														$message ="<html>								   <body>								   <hr>								   								   <p> <strong><font color ='#69571F'><em>First</em></font></strong> =><font color ='#858685'> {$first}</font></p>								   <p> <strong><font color ='#69571F'><em>Last</em></font></strong> =><font color ='#858685'> {$last}</font></p>								   <p> <strong><font color ='#69571F'><em>Comments </em></font></strong> =><font color ='#858685'> {$comments}</font></p>								   								   <p> ORDER Details </p>								   while($records = mysql_fetch_array($fetch))								   {																				$message .= 'record for user ' . $records['TIMESTAMPS'] . '<br>';										$message .= 'record for user ' . $records['ORDERID'] . '<br>';										$message .= 'record for user ' . $records['ORDERNUM'] . '<br>';										$message .= 'record for user ' . $records['STATUS'] . '<br>';									    $message .= 'record for user ' . $records['COMMENTS'] . '<br>';									}																											   								   <hr>								   </body>								   </html>";								   						$header = 'MIME-Version: 1.0' . "rn";						$header .= 'Content-type: text/html; charset=iso-8859-1' . "rn";									$header .= "From: {$from}rn"; 						$header .= "Reply-To: {$to}rn"; 						$header .= "Return-path: " . $to; 		   												//mail($to, $subject, $message,"From:".$from, "-f$from");						 						mail( $to,  $subject, $message, $header, "-f{$from}"); 			}	?>
  16. Getting an error

     

    Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in C:inetpubwwwrootemailcustomer.php on line 141.

     

    while ($records = mysql_fetch_array($fetch)) { $message .= 'record for user ' . $records['TIMESTAMPS'] . '<br>'; // LINE NO 141 $message .= 'record for user ' . $records['CUSTOMERID'] . '<br>'; $message .= 'record for user ' . $records['ORDER'] . '<br>'; $message .= 'record for user ' . $records['COMMENTS'] . '<br>'; }

  17. I want to sending a mail after fetching multiple records from the table, the searching is based on date, mean what ever the records entered by user on the current date that need to be mail to the specific person.

     

    table from which is need to fetch the records is order_details

     

    below is my current script..

    $selectcondition = "SELECT * FROM order_details where DATE='".$date."'"; // From this table i need to fetch all the records date wise.                        $check=mysql_query($selectcondition,$con);                        $fetch=mysql_fetch_row($check);                                                                        while($row = mysql_fetch_array($fetch))                        {                          //                        }                                                    $from="REPORT@abc.com";                        $to="admin@abc.com";                        $subject="Customer report of $date";                                                                        $message ="<html>                                   <body>                                   <hr>                                                                      <p> <strong><font color ='#69571F'><em>First</em></font></strong> =><font color ='#858685'> {$first}</font></p>                                   <p> <strong><font color ='#69571F'><em>Last Person</em></font></strong> =><font color ='#858685'> {$last}</font></p>                                   <p> <strong><font color ='#69571F'><em>Comments </em></font></strong> =><font color ='#858685'> {$comments}</font></p>                                   <hr>                                   </body>                                   </html>";                                                           $header = 'MIME-Version: 1.0' . "rn";                        $header .= 'Content-type: text/html; charset=iso-8859-1' . "rn";                                    $header .= "From: {$from}rn";                        $header .= "Reply-To: {$to}rn";                        $header .= "Return-path: " . $to;                                                            //mail($to, $subject, $message,"From:".$from, "-f$from");                                                mail( $to,  $subject, $message, $header, "-f{$from}");            }   

    Right now only the customer information are sending with mail, now i want customer orders detail also should be part of body of a mail... ( single mail is needed for both the thing customer information & order details)

     

    Hope i can able to understand you guys my need , Please let me know if something you need to know more on this..

     

    Thanks In Advance..

     

     

  18. Now i am getting the mails, But the mails is clearly in the plain text format below is the output of a mail

     

    First Name : Rohit

    Last Name: kapoor

    Comments : xyz

     

    I want some formatting on the outgoing mails, Can it will be possible like (If I bold [First Name, Last Name]) so it looks more good

     

    Below is the code..

    $from="some@abc.com";$email="Rohit@xyz.com";$subject="You are registered on $date";$message='Fist Name : '.$First."n"                   .'Last Name : '.$last."n"                   .'Comments : '.$comments."n";  mail($email, $subject, $message,"From:".$from, "-f$from");

    Thanks in advance

     

     

     

×
×
  • Create New...