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", "SubscrNotifMailer@gmail.com");
	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
Share on other sites

What kind of error are you getting for the e-mail? I can't see anything immediately wrong but it depends where you're getting the error.

 

As for a button, just use plain old HTML in the message argument of the mail() function:

 

<input type=button value='ClickyClicky'>

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.