Trying to patch a php page together from elements from other pages without really understanding what's going on is probably frowned upon, but you've got to start somewhere!
The code below is supposed to include some pieces of text from msql table and include them in an email. The email is being sent, but I clearly don't know how to get it to include the database elements because those bits are missing in the email. I can confirm that the correct record is being accessed by the page.
Can someone give me the vital clue please? I promise I will study php one day soon!
Many thanks,
Steve
The code below is supposed to include some pieces of text from msql table and include them in an email. The email is being sent, but I clearly don't know how to get it to include the database elements because those bits are missing in the email. I can confirm that the correct record is being accessed by the page.
Can someone give me the vital clue please? I promise I will study php one day soon!
Code:
<?php require_once('../../Connections/tormented3.php'); ?>
<?php
$colname_rstSix = "1";
if (isset($_GET['organ'])) {
$colname_rstSix = (get_magic_quotes_gpc()) ? $_GET['organ'] : addslashes($_GET['organ']);
}
mysql_select_db($database_tormented3, $tormented3);
$query_rstSix = sprintf("SELECT * FROM chk_sixmonth WHERE ck_organisation = '%s'", $colname_rstSix);
$rstSix = mysql_query($query_rstSix, $tormented3) or die(mysql_error());
$row_rstSix = mysql_fetch_assoc($rstSix);
$totalRows_rstSix = mysql_num_rows($rstSix);
if(isset($_POST['send'])){ // 'submit' is the name of your submit button
$error = '';
if($error == ''){ // if no error, process the form
// place here your mail script
$start = "There is an update from\n";// Set up the email message header
$tit = $row_rstSix['ck_organisation'];
$first = $row_rstSix['ck_firstname'];
$sur = $row_rstSix['ck_lastname'];
$message .= "$start $tit Contact name: $first $sur\n";
if(mail("feedback@tormented.org.uk", "Update Notification.",
$message, "From ")){
header('location:[URL unfurl="true"]http://www.torbayhelp.org.uk/up_content/org_changechoice.php');//[/URL] redirect to page if email has been successfully sent
exit;
}else{
$error == '<p style="color:red;">An error occured, your email could not be sent. Please try
again</p>';
}
}
}
?>
Many thanks,
Steve