想要在警报框中添加样式

时间:2016-03-28 11:29:06

标签: javascript php html

我想在注册后发送邮件,但它无法正常工作,我不知道错误可以帮助我解决问题

的javascript

// WRITE THE VALIDATION SCRIPT IN THE HEAD TAG.
function isNumber(evt) {
  var iKeyCode = (evt.which) ? evt.which : evt.keyCode
  if (iKeyCode != 46 && iKeyCode > 31 && (iKeyCode < 48 || iKeyCode > 57))
    return false;
  return true;
}

html + php

<html>
  <body>
    <form name="reg"  action="code_exec.php"  method="post">
      <table width="274" border="0" align="center" cellpadding="2" cellspacing="0">
        <tr>
          <td colspan="2">
            <div align="center">
              <?php 
                $remarks=$_GET['remarks'];
                if ($remarks==null and $remarks=="") {
                  echo 'Register Here';
                }
                if ($remarks=='success') {
                  echo 'Registration Success';
                }
              ?>    
            </div>
          </td>
        </tr>
        <tr>
          <td width="95"><div align="right">Mobile_no:</div></td>
          <td width="171"><input type="text" ID="tbNumbers" name="mobile_no" required maxlength="10" onkeypress="javascript:return isNumber(event)" /></td>
        </tr>
        <tr>
          <td><div align="right">Name:</div></td>
          <td><input type="text" name="name" required/></td>
        </tr> 
        <tr>
          <td><div align="right">E_mail:</div></td>
          <td><input type="text" name="e_mail" E_MAIL required pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,3}$" /></td>
        </tr>
        <tr>    
          <td><div align="right">Password:</div></td>
          <td><input type="password" name="password" required pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}" title="Must contain at least one number and one uppercase and lowercase letter, and at least 8 or more characters"/></td>
        </tr>
        <tr>
          <td><div align="right"></div></td>
          <td><input name="submit" type="submit" value="Submit" /></td>
        </tr>
      </table>
    </form>
    <!-- Javascript -->
    <script src="assets/js/jquery-1.8.2.min.js"></script> 
    <script src="assets/bootstrap/js/bootstrap.min.js"></script>
    <script src="assets/js/jquery.backstretch.min.js"></script>
    <script src="assets/js/scripts.js"></script>
  </body>
</html>

我想在注册后发送邮件,自动生成的客户ID

<?php
session_start();
$con       = mysqli_connect("retail", "RS", "orbisindia", "rs");
$mobile_no = $_POST['mobile_no'];
$name      = $_POST['name'];
$e_mail    = $_POST['e_mail'];
$password  = $_POST['password'];
$Cust_Id   = time();
$message   = "";
try {

        // execute the stored procedure
        $sql = mysqli_query($con,"CALL sp_retail_reg('$Cust_Id','$mobile_no','$name','$e_mail','$password')");
 if(!empty($Cust_Id)) {

$toEmail = $_POST['e_mail'];
$subject = "Thank you for registration";
$content = "your Custotmer id is" . $Cust_Id ;
    $content1 = "your Password is" . $password ; 
$mailHeaders = "From: rohit.jha@99rstreet.com";

if(mail($toEmail, $subject, $content,$content1, $mailHeaders)) {
    $message = "You have registered and your cutomer id  is sent to your email. plze check spam Also."; 
}
unset($_POST);

}

    } catch (PDOException $pe) {
        die("Error occurred:" . $pe->getMessage());
    }

$ message。=&#34;您的Cust_Id = $ Cust_Id&#34 ;;  echo&#34; alert(&#39; $ message&#39;); window.location.href =&#39; home.php&#39 ;;&#34 ;;

1 个答案:

答案 0 :(得分:0)

从提醒window.location.href的code_exec.php中删除customerid

echo "<script>alert('$message'); window.location.href='home.php';</script>"

在调用student_confirmation函数之前重定向到home.php。 您可以在调用student_confirmation函数后编写它。