Jump to content

Php mail and Mysql help needed


Brobinson

Recommended Posts

I'm stumped. I dont know what I did wrong. Can someone show me the errors of my ways? what i'm trying to do is propagate the $subject, $body, and $headers from my database.

sincerely;

Bryan

 

<?php
	require_once('connect_to_db.php');
	include ("includes/nav/main_nav.html");

	$dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);

// grabs the ID of the specific job passed from the projects_working.php page
	$pmo_id = $_GET['pmo_id'];

// if the submit button on the form is clicked,  determine which info will be sent to the database
	if ($_POST['submit']) {
			$pmo_id = $_POST['pmo_id'];
			$staff = $_POST['staff'];


// if a specific ID number is present, write the new info to the database 	
	if ($pmo_id) {
		$query = "UPDATE promo_form SET staff='$staff' WHERE pmo_id='$pmo_id'" OR die ('Could not run query!');
		mysqli_query ($dbc, $query);
		}
	}

$to = $staff;
$subject = "New job: " .$pmo_promoname;
$body = "Promo Type: " .$pmo_promotype."";
$body .= "Start date: " .$pmo_startdate;
$body .= "Start time: " .$pmo_starttime;
$body .= "Location: " .$pmo_location;
$body .= "Details: " .$pmo_wheredetails2;
$headers = 'From: [email protected]';
$headers .= 'Cc: ' .$pmo_email; 

mail($to, $subject, $body, $headers);
   // yay!
echo "<p>Notification has been sent to the designer</p>";		
?>

Link to comment
https://forums.phpfreaks.com/topic/244576-php-mail-and-mysql-help-needed/
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.