我正在使用一种形式,该形式将用户的电子邮件作为输入并将其存储在数据库中。问题是我将电子邮件分为三部分->用户名,emailprovider,结尾(.com,.edu等)。在提交时调用下面的函数。我如何获得新的电子邮件(在concat之后)并将其存储在数据库中?我希望我的解释足够具体。
function checkEmail(part1,part2,part3){
var result=true;
var notAllowed = new RegExp("/\W/");
var email="";
if (notAllowed.test(part1) || notAllowed.test(part2) || notAllowed.test(part3)){
result=false;
}else{
email=part1.concat("@"+part2,"."+part3);
}
return result,email;
}
作为您的标记PhP并需要将其发送到数据库,您做错了。
我认为这是在网站上运行的。你应该做的是使用
$_GET["part1"]
然后将它们串联成一个字符串。这样您就可以在PhP中使用sql语句轻松写入数据库
$ fullemail = $ string1。$ string2。$ string3;
编辑:如果要再次串联它,为什么要分解它?
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句