Jump to content

[SOLVED] info not going to db, email not sending


aebstract

Recommended Posts

Hi again, back so soon! I put a else die on the end of my connecting to DB.. so I am 99% sure that isn't my problem here. No information is being placed in the database and no email is being sent out. Any ideas on why not?

 

<?php
session_start();
header("Cache-control: private");

if (isset ($_POST['submit'])) {
$problem = FALSE;



if (empty ($_POST['plantloc'])) {
$problem = TRUE;
$error .= 'Must enter a plant location<br />';
}







mysql_connect("*","*","*");
mysql_select_db("*");


if (!$problem) {

$plantloc  = $_POST['plantloc'];

$length = 6;
$password = "";
$possible = "0123456789bcdfghjkmnpqrstvwxyz"; 
$i = 0; 
    
while ($i < $length) { 
    $char = substr($possible, mt_rand(0, strlen($possible)-1), 1);
    if (!strstr($password, $char)) { 
      $password .= $char;
      $i++;
    }

  }

$password2 = md5($_POST['password1']);
$address = $_POST['address'];


$result = MYSQL_QUERY("INSERT INTO plants (plantloc,password,address)".
"VALUES ('$plantloc, '$password2', '$address,')");


$sendmail = "
$password2
";

mail ('tcantwell@berryequipment.net', 'Thank You', $sendmail, 'From: aebstract@gmail.com');



} else {
$content .= "$error";
}
}
?>

Link to comment
Share on other sites

Put a mysql_error after your Query

 

$result = MYSQL_QUERY("INSERT INTO plants (plantloc,password,address)".

"VALUES ('$plantloc, '$password2', '$address,')") or die (mysql_error());

 

It should reveal a error since you forgot a ' after $plantloc and you have a comma after $address

Link to comment
Share on other sites

Alright I called in because I looked at my error log and had nothing dealing with mail in it. Couldn't find my php.ini file so he placed one in my html directory. I don't know anything about the php.ini file so I have no clue how to find what I need or check what it should be. He did a simple one line mail function test and said it was working so it may be my syntax?

Link to comment
Share on other sites

I'm back on the phone right now, will ask and I found this in my php.ini:

[mail function]
; For Win32 only.
SMTP = localhost

; For Win32 only.
sendmail_from = me@localhost.com

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
sendmail_path = /usr/sbin/sendmail -t -i

 

I'm thinking it may be wrong "me@localhost.com" and I'm on a .net domain. So maybe it isn't sending out correctly? I'll come back with another update soon.

Link to comment
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.