Im trying to convert a page that I have working already. It works now as a submit page that sends me an email with the information.
I want it to write that information to an Access database, as well as still send the email.
heres the PHP that was working for the email page.
Code:
<?php
ob_start();
include 'class.php';
if (isset($_POST['firstname'])) {
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$address1 = $_POST['address1'];
$address2 = $_POST['address2'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$email = $_POST['email'];
$lubricant = $_POST['lubricant'];
$msg = "Attention Sliquid! You have a new Sliquid sample request!
First Name = {$firstname}
Last Name = {$lastname}
Address = {$address1}
Address 2 = {$address2}
City = {$city}
State = {$state}
Zip = {$zip}
Email = {$email}
Lubricant Choice = {$lubricant}";
ini_set(SMTP, "mail.sliquid.com");
ini_set(smtp_port, 25);
ini_set(sendmail_from, "sales@sliquid.com");
$headers = "From: sales@sliquid.com\r\n";
$headers .= "BCC: samples@sliquid.com\r\n";
//mail(To, subject, content, header);
$to = "samples@sliquid.com";
$result = mail($to, "Sliquid Sample Request", $msg, $headers);
if( $result == 0 ) {
echo "error <br>";
}
header("location: http://www.sliquid.com/verify2.htm");
}
ob_flush();
?>
I took some code from another page that i had working on my computer. It wrote to an Access DB, and displayed the results. So heres what I did to alter:
Code:
<?php
ob_start();
include 'class.php';
function Enter_New_Entry($FirstName,$LastName,$Address1,$Address2,$City,$State,$Zip,$Email,$LubricantChoice) {
/*
First, we create a connection to our ODBC source. This is done by creating
a connection. Once this is done, we are returned an ODBC connection number.
We use this number to use the ODBC functions within PHP.
*/
$cnx = odbc_connect( 'customers' , 'Admin', '*****' );
if (!$cnx) {
Error_handler( "Error in odbc_connect" , $cnx );
}
$SQL_Exec_String = "Insert Into customers (FirstName, LastName, Address1, Address2, City, State, Zip, Email, LubricantChoice)
Values ('$FirstName', '$LastName', '$Address1', '$Address2', '$City', '$State', '$Zip', '$Email', '$LubricantChoice')";
$cur= odbc_exec( $cnx, $SQL_Exec_String );
if (!$cur) {
Error_handler( "Error in odbc_exec( no cursor returned ) " , $cnx );
}
odbc_close( $cnx);
}
Enter_New_Entry($FirstName,$LastName,$Address1,$Address2,$City,$State,$Zip,$Email,$LubricantChoice);
if (isset($_POST['firstname'])) {
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$address1 = $_POST['address1'];
$address2 = $_POST['address2'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$email = $_POST['email'];
$lubricant = $_POST['lubricant'];
$msg = "Attention Sliquid! You have a new Sliquid sample request!
First Name = {$firstname}
Last Name = {$lastname}
Address = {$address1}
Address 2 = {$address2}
City = {$city}
State = {$state}
Zip = {$zip}
Email = {$email}
Lubricant Choice = {$lubricant}";
ini_set(SMTP, "mail.sliquid.com");
ini_set(smtp_port, 25);
ini_set(sendmail_from, "sales@sliquid.com");
$headers = "From: sales@sliquid.com\r\n";
$headers .= "BCC: samples@sliquid.com\r\n";
//mail(To, subject, content, header);
$to = "samples@sliquid.com";
$result = mail($to, "Sliquid Sample Request", $msg, $headers);
if( $result == 0 ) {
echo "error <br>";
}
header("location: http://www.sliquid.com/verify2.htm");
}
ob_flush();
?>
now, when i access the page in a browser, it just sits there blank. no error, no nothing.
any ideas????