Jump to content

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

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.