0

Hello,

I am trying to create registration form that automatically send automatic email after the user press next.

Registration1.php

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Registration</title>
    <meta charset="utf-8">
    <meta name="description" content="Your description">
    <meta name="keywords" content="Your keywords">
    <meta name="author" content="Your name">
    <link rel="stylesheet" href="css/style.css">
    <script src="js/jquery-1.7.1.min.js"></script>
    <script src="js/script.js"></script>
    <script type="text/javascript">
        $(document).ready(function() {
            $("#login").click(function() {
                $(".login_box").slideToggle('fast');
            });
        }); 
    </script>
    <script type="text/javascript">
        function myFunction()
        {
        document.getElementById('login_box').style.display='none';
        }
    </script>
<!--[if lt IE 8]>
   <div style=' clear: both; text-align:center; position: relative;'>
     <a href="http://windows.microsoft.com/en-US/internet-explorer/products/ie/home?ocid=ie6_countdown_bannercode">
       <img src="http://storage.ie6countdown.com/assets/100/images/banners/warning_bar_0000_us.jpg" border="0" height="42" width="820" alt="You are using an outdated browser. For a faster, safer browsing experience, upgrade for free today." />
    </a>
  </div>
<![endif]-->
<!--[if lt IE 9]>
    <script src="js/html5.js"></script>
    <link rel="stylesheet" href="css/ie.css"> 
<![endif]-->
</head>
<body>

<?php include('menu.php'); ?>

<br><br><br>

<div class="bg-main" onClick="myFunctionDisplayNone()">
    <header>
        <div class="container_24">
            <div class="wrapper">                        

            </div><br><br>         

<?php

    include('includes/koneksi.php');

    $confirmation = isset($_POST['confirmation']) ? $_POST['confirmation'] : '';  
    $stu_fname = isset($_POST['stu_fname']) ? $_POST['stu_fname'] : ''; 
    $stu_lname = isset($_POST['stu_lname']) ? $_POST['stu_lname'] : ''; 
    $stu_email = isset($_POST['stu_email']) ? $_POST['stu_email'] : '';
    $stu_telp = isset($_POST['stu_telp']) ? $_POST['stu_telp'] : ''; 
    $stu_skype = isset($_POST['stu_skype']) ? $_POST['stu_skype'] : '';
    $term = isset($_POST['term']) ? $_POST['term'] : '';

    //Simpan Data Pendaftar 
    if (isset($_POST['register'])){

            //if(!empty($stu_fname && $stu_lname && $stu_email && $stu_telp && $stu_skype)){

            $sqlstr = "INSERT INTO student(stu_fname, stu_lname, stu_email, stu_telp, stu_skype) VALUES('".$stu_fname."','".$stu_lname."','".$stu_email."','".$stu_telp."','".$stu_skype."')";

            $result = mysql_query($sqlstr) or die(mysql_error());

            /*} 
            else
            {           
            echo "Please fill-in all fields information in this form.";
            }*/

        //Jika mode edit, maka tidak akan dikirimkan konfirmasi kepada subscriber
        //if (empty($_REQUEST['id']))   kirimEmail($idKategori, $judul, $news);
        $confirmation = ($result) ? "Data telah tersimpan." : "Gagal menyimpan data.";  

        header("location:registration2.php");
    }


?>


<img src="images/shanghai.jpg" width="950px" height="200px"><br><br><br>    

<?php
            /*
            include('includes/koneksi.php');

            $result = mysql_query("SELECT * FROM static_page WHERE post_id='2'") or die(mysql_error());

                    $data = mysql_fetch_array($result);

                    echo '<h2>'.$data['judul'].'</h2><br><br>';     
                    echo $data['isi_berita'];

        */  ?><br>

<table style="width: 1000px">

<img src="images/registrationbar1.png" height="70px" width="850px"><br><br><br>

<form name="registration1" action="<?php $_SERVER['PHP_SELF']; ?>" method="POST">

<tr>
    <td>First Name</td>
    <td><input style="width: 500px;" type="text" name="stu_fname" size="80px"><br><br></td>
</tr>
<tr>
    <td>Last Name</td>
    <td><input style="width: 500px;" type="text" name="stu_lname" size="80px"><br><br></td>
</tr>
<tr>
    <td>Email Address</td>
    <td><input style="width: 500px;" type="text" name="stu_email" size="80px"><br><br></td>
</tr>
<tr>
    <td>Phone No</td>
    <td><input style="width: 500px;" type="text" name="stu_phone" size="80px"><br><br></td>
</tr>
<tr>
    <td>Skype</td>
    <td><input style="width: 500px;" type="text" name="stu_skype" size="80px"><br><br></td>
</tr>
    <td></td>
    <td><input type="checkbox" name="term" value="">I have read and understand the <a href="#">Terms & Conditions</a>
    </td>    

</table>       

<input type="submit" class="button" name="register" value="Simpan"> 

</form>

</div>

<?php include('footer.php'); ?>

</body>
</html>

Registration2.php

<!DOCTYPE html>
<html lang="en">
<head>
    <title>Registration</title>
    <meta charset="utf-8">
    <meta name="description" content="Your description">
    <meta name="keywords" content="Your keywords">
    <meta name="author" content="Your name">
    <link rel="stylesheet" href="css/style.css">
    <script src="js/jquery-1.7.1.min.js"></script>
    <script src="js/script.js"></script>
    <script type="text/javascript">
        $(document).ready(function() {
            $("#login").click(function() {
                $(".login_box").slideToggle('fast');
            });
        }); 
    </script>
    <script type="text/javascript">
        function myFunction()
        {
        document.getElementById('login_box').style.display='none';
        }
    </script>
<!--[if lt IE 8]>
   <div style=' clear: both; text-align:center; position: relative;'>
     <a href="http://windows.microsoft.com/en-US/internet-explorer/products/ie/home?ocid=ie6_countdown_bannercode">
       <img src="http://storage.ie6countdown.com/assets/100/images/banners/warning_bar_0000_us.jpg" border="0" height="42" width="820" alt="You are using an outdated browser. For a faster, safer browsing experience, upgrade for free today." />
    </a>
  </div>
<![endif]-->
<!--[if lt IE 9]>
    <script src="js/html5.js"></script>
    <link rel="stylesheet" href="css/ie.css"> 
<![endif]-->
</head>
<body>

<?php include('menu.php'); ?>

<div class="bg-main" onClick="myFunctionDisplayNone()">
    <header>
        <div class="container_24">
            <div class="wrapper">                        
                <br><br>                          
            </div><br><br>         

<?php

include('includes/koneksi.php');

$result = mysql_query("SELECT * FROM student") or die(mysql_error());

$data = mysql_fetch_array($result);

$fname = $data['stu_fname'];
$lname = $data['stu_lname'];
$email = $data['stu_email'];

echo $fname;
echo $lname;
echo $email;


// write program to send email to the recorded email address

    require_once('recaptchalib.php');
    $name = strip_tags(@$_POST['name']);
    $email = str_replace(" ", "", strip_tags(@$_POST['email']));
    $phone = str_replace(" ", "", strip_tags(@$_POST['phone']));
    $message = strip_tags(@$_POST['message']);
    if (@$_POST['submit']) {
    if ($name&&$email&&$phone&&$message) {
    if (is_numeric($phone)) {
    $privatekey = "6LfjvdcSAAAAAHNcKjYO5DhTNefxYZHYcfhtrvGC";
    $resp = recaptcha_check_answer($privatekey,
    $_SERVER["REMOTE_ADDR"],
    $_POST["recaptcha_challenge_field"],
    $_POST["recaptcha_response_field"]);
    if (!$resp->is_valid) {
    //What happens when the CAPTCHA was entered incorrectly
    echo "The reCAPTCHA wasn't entered correctly.";
    } else {
    //Your code here to handle a successful verification
    ini_set("SMTP", "smtp.mail.yahoo.com");
    $body = "
    Name: ".$name."
    Phone: ".$phone."
    Email: ".$email."\n\n
    ".$message;
    mail("davy_yg@yahoo.com", "Message from Innovation Website", $body, "From: ".$email);
    echo "Your message has been sent, we will get back to your shortly.";
    $name = trim("");
    $email = trim("");
    $phone = trim("");
    $message = trim("");
    }
    }
    else
    echo "There should only be numbers in your phone number.";
    }
    else
    echo "Please fill in <b>all</b> the fields!";
    }

?>          

<h3>PLEASE COMPLETE THE FOLLOWING REGISTRATION PROGRESS!</h3><br><br>

<form id="registration-form">

<table style="width: 1000px">

<img src="images/registrationbar2.png" height="70px" width="850px"><br><br><br>

<tr>
    <img src="images/email.png" width="50px">&nbsp;&nbsp;An email has been sent to your inbox.  Please check your email to continue.<br><br><br>
</tr>


</table>       


</form>

</div>

<?php include('footer.php'); ?>

</body>
</html>

After the user go from registration1.php to registration2.php an email suppose to be sent to the user email with a link that if the user press the link it will open registration3.php to continue the process.

I already able to capture information from registration1.php but not sending an email to the user email address yet, and also how to create the email that consist the link for registration3.php ?

Is it okay if I just send a normal email link ?

Thanks before.

2
Contributors
1
Reply
13
Views
3 Years
Discussion Span
Last Post by hericles
0

As far as sending the email goes, are you trying this from a server or just on your local machine? Because you need a working mail server for the email to be sent.
As for the link to the third page, a link that includes either the user's email or a unique identifier that can be used to locate them again on page three is required. You need to receive something onto page 3 that yets you continue the process with the correct user.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.