Jump to content

email php


techker

Recommended Posts

hey guys i have this code that send send me an email when i insert a=data in my databse.

 

now it was working fine ..lol intill i messt arround with it.

 

and is it possible to add a button with a link in the email that is sent ??

 

<?php // function declaration, placed at beginning of script with
//other function declarations

	function SubscrNotifMailer($message, $headers) 
	{ 

	  $to = "my email"; 
	  $subject = "Installation Confirmation"; 

	  mail($to, $subject, $message, $headers); 

	}


?>


<?php

$client_id=$_POST['client_id'];
$comp_name=$_POST['comp_name'];
$num_units=$_POST['num_units'];
$extra=$_POST['extra'];
$done=$_POST['done'];
$not_complete=$_POST['not_complete'];
$installer=$_POST['installer'];
$date = date("Y-m-d"); 
//$data = addslashes(fread(fopen($form_data, "r"), filesize($form_data)));
// Connects to your Database
mysql_connect("localhost", "ll", "l") or die(mysql_error()) ;
mysql_select_db("l") or die(mysql_error()) ;

//Writes the information to the database
mysql_query("INSERT INTO install (client_id,comp_name,num_units,extra,done,not_complete,installer,date) ".
        "VALUES ('$client_id','$comp_name','$num_units','$extra','$done','$not_complete','$installer','$date')");



//Tells you if its all ok
$id= mysql_insert_id();
// function call, placed right after record insertion of new
//subscription

	$nl = chr(10); 

	$emailStr = 'Email : ' . $email . $nl ; 
	$client_id = 'Client ID : ' . $_POST['client_id'] . $nl ; 
	$comp_name = 'Comp Name: ' . $_POST['comp_name'] .  $nl; 
	$done = 'Is Job Done : ' . $_POST['done'] . $nl ; 
	$not_complete = ' Is Job not finisht : ' . $_POST['not_complete'] . $nl ; 
	$installer = 'Installer: ' . $_POST['installer'] . $nl ; 
	$date = 'date done: ' . date("Y-m-d") . $nl ; 
        $num_units = 'Number of Units installed: ' . $_POST['num_units'] . $nl ; 



	$message = $emailStr . $client_id . $comp_name . $done  .
$not_complete . $installer . $date . $num_units  ;

	$headers .= "Reply-To: ".$email."\r\n"; 

	ini_set("sendmail_from", "[email protected]");
	SubscrNotifMailer($message, $headers);  // call mailer

    		echo "<p>This file has the following Database ID: <b>$id</b>";
echo "You'll be redirected to Home Page after (2) Seconds";
          echo "<meta http-equiv=Refresh content=2;url=job.php>";

?>

Link to comment
https://forums.phpfreaks.com/topic/176232-email-php/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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