Jump to content

Need some help with user notification email?


andy_b_1502

Recommended Posts

Hi, ive been looking all over for a script to send an email once users on my site register their details, is this possible? all i want is it to send their username and password.

Also the same sort of thing is needed for the "lost password" button?

 

Any help suggested would be great, many thanks.

 

Web Form/Registration:

 

<form action="sendAd.php" method="post">
<h4 class="style7">Type of company (Removal, Transport, Storage, Insurance, Local Area or Other):<br />
<input type="text" name="type"/>
<br />Company name:<br />
<input type="text" name="company_name"/>
<br />
Location:<br />
<input type="text" name="location"/>
<br />
Six bullet point description of your company:<br />
<textarea rows="6" cols="21" name="description" ></textarea>
</h4>
<h4 class="style7">               <br />
<input name="submit" type="submit" id="submit" value="List your ad" />
  </h4>
<p> </p>
</form>

 

SendAd.php:

<?PHP

$user_name = "";
$password = "";
$database = "removal2";
$server = "server";
$db_handle = mysql_connect($server, $user_name, $password);
$db_found = mysql_select_db($database, $db_handle);

if ($db_found) {

$SQL = "INSERT INTO ads (type, company_name, location, description) 
   VALUES ('" .$type. "', '" .$company_name. "', '" .$location. "', '" .$description. "')";
$result = mysql_query($SQL);

mysql_close($db_handle);

header( 'Location: http://www.removalspace.com/advert-confirm.php' );  exit();
}
else {
print "Database NOT Found ";
mysql_close($db_handle);
}
?>

 

MOD EDIT: code tags added.

Your variables are passed using the POST method, so you need to grab them all like this:

$company_name = $_POST['company_name'];

before you can insert them into a database.

 

for sending an email, check out the mail function

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.