# Send email upon successfull registration

**URL:** <https://forum.kirupa.com/t/send-email-upon-successfull-registration/174491>\
**Category:** Uncategorized\
**Created:** [January 6, 2006, 4:10am UTC](https://forum.kirupa.com/t/send-email-upon-successfull-registration/174491 "2006-01-06T04:10:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pixeldude](https://avatars.discourse-cdn.com/v4/letter/p/57b2e6/32.png) [@pixeldude](https://forum.kirupa.com/u/pixeldude)\
**Post date:** [January 6, 2006, 4:10am UTC](https://forum.kirupa.com/t/send-email-upon-successfull-registration/174491/1 "2006-01-06T04:10:36Z")

</div>

Hello there…

ok I just make a simple registration page and login page using flash which is work ok …and this is my php code I’m using

```php

<?php
// include the Database classes
require_once('../classes/database.php');

// escape quotes and apostrophes if magic_quotes_gpc off
if (!get_magic_quotes_gpc()) {
  foreach($_POST as $key=>$value) {
    $temp = addslashes($value);
    $_POST[$key] = $temp;
    }
  }

// create a Database instance and check username
$db = new Database('localhost','','','ecard');
$sql = 'SELECT username FROM users WHERE username = "'.$_POST['username'].'"';
$result = $db->query($sql);
$numrows = $result->num_rows;

// if username already in use, send back error message
if ($numrows > 0) {
  $duplicate = 'Duplicate username. Please choose another.';
  echo 'duplicate=y&message='.urlencode($duplicate);
  }
else { // insert the data into the users table
  $sql = 'INSERT INTO users (first_name,family_name,username,pwd)
          VALUES ("'.$_POST['first_name'].'","'.$_POST['family_name'].'",
          "'.$_POST['username'].'","'.$_POST['pwd'].'")';
  $result = $db->query($sql);
  if ($result) {
    $created = 'Account created for '.$_POST['username'];
    echo 'duplicate=n&message='.urlencode($created);
    }
  }
?>

```

so my problem is how to insert a code for send email upon the successfull registered user…I m ean when the user open up their mail it will goes liek this

\*\*Welcome to blaablaablaa – the fast, fun and easy way to share personalized greetings. You can begin creating your own cards immediately – just sign in with the following information: Email address: email provide by user  
Password: 123456

To get started, click [www.blabla.com/login.html](http://www.blabla.com/login.html) Thanks again for joining blaablaablaa!

Sincerely,

Customer Care at blaablaablaa \*\*

Hope U guys can guide me or some walkthrough…

'tq
