Jump to content

Recommended Posts

Below is the code to contact2.php...contact.php is basically an html page with the form that posts the form data to this page...now my problem is when I try to view this page on the server after clicking the submit button I am greeted with a totally blank white screen.  Haven't really run into this problem before....HELP!

 

<?php 

$submit = $_POST["Submit"];
if ($submit == "Submit") {

$db="334311_guttergraphics"; 
$link = mysql_connect("mysql5-14.wc1", "*******", "******");
if (! $link)
die("Our database is experiencing technical difficulties. Please contact our Webmaster");
else{
mysql_select_db($db , $link)
or die("Select DB Error: ".mysql_error());
}

//check for valid email address
  if(stristr($_POST['email'], "@") === FALSE) { 
  echo "<br><br><br><br><table width='400' border='1' bgcolor='white' cellspacing='0' cellpadding='0' align='center'>
                <tr>
                  <td><a href='#' onClick='history.go(-1)'>Back</a><br> Email Address was Invalid.<br> Please verify that you have entered a proper email address.</td>
                </tr>
              </table>" ; exit();
  } 
  
$form1 = $_POST["firstname"];
$form2 = $_POST["lastname"];
$form3 = $_POST["address1"];
$form4 = $_POST["address2"];
$form5 = $_POST["city"];
$form6 = $_POST["state"];
$form7 = $_POST["zip"];
$form8 = $_POST["homephone"];
$form9 = $_POST["altphone"];
$form11 = $_POST["email"];
$form13 = $_POST["comment"];
  
//loop through _post array and insert into database
$query = "INSERT INTO contact (id,firstname,lastname,address1,address2,city,state,zip,homephone,altphone,email,comment)
VALUES('','$form1', '$form2','$form3','$form4','$form5','$form6','$form7','$form8','$form9','$form11','$form13')";
$result = mysql_query($query) or die(mysql_error());

// Send email
require_once "Mail.php";

$to = "ross@guttergraphics.com, contact@theultimategutter.com";
$from = "casey@guttergraphics.com";
$subject = "Quote - ".$_SERVER['HTTP_HOST']." at ".$_POST["time"];
$message = "\nFirst: " .$form1 ."\n" ."Last: " .$form2 ."\nCity: " .$form5 ."\n" ."State: " .$form6."\nPhone: ".$form8."\n" ."Address1: " .$form3."\n" ."Address2: " .$form4 ."\nZipcode: " .$form7 ."\nHome Phone: " .$form8 ."\nAlternate Phone: " .$form9 ."\nEmail: " .$form11 ."\nComments: ".$form13.;

$host = "mail.guttergraphics.com";
$username = "casey@guttergraphics.com";
$password = "portable";

$headers = array ('From' => $from,
  'To' => $to,
  'Subject' => $subject);

$smtp = Mail::factory('smtp',
  array ('host' => $host,
    'auth' => true,
    'username' => $username,
    'password' => $password));

$mail = $smtp->send($to, $headers, $message);

if (PEAR::isError($mail)) {
  echo("<p>" . $mail->getMessage() . "</p>");
} else {
}
}
?>

Link to comment
https://forums.phpfreaks.com/topic/125292-mail-system/
Share on other sites

Php gets parsed by the server so only output is displayed, in this case no echo/print no html.

 

But it would help if you could refraise your question? I may have misunderstood what you where trying ask. Also please use code tags.

 

One more thing do NOT post database information like passwords and other sensitive info, you don`t know hoe mite take attvantage of that information!

Link to comment
https://forums.phpfreaks.com/topic/125292-mail-system/#findComment-649413
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.