techker Posted October 1, 2009 Share Posted October 1, 2009 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>"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/176232-email-php/ Share on other sites More sharing options...
Paystey Posted October 5, 2009 Share Posted October 5, 2009 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'> Quote Link to comment https://forums.phpfreaks.com/topic/176232-email-php/#findComment-931001 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.