here my problem is ,when i check if the username is exist in the DB ,there must have one option to re enter it.In this program when i make an attempt to reenter the username.it will clear all the other contents also(emailid).Please help me to locate the cursor in username field only and do not change the other fields. -
<html>
-
<script language = "Javascript" type="text/javascript">
-
/**
-
* DHTML email validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
-
*/
-
-
function echeck(str) {
-
-
var at="@"
-
var dot="."
-
var lat=str.indexOf(at)
-
var lstr=str.length
-
var ldot=str.indexOf(dot)
-
if (str.indexOf(at)==-1){
-
alert("Invalid E-mail ID")
-
return false
-
}
-
-
if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr)
-
{
-
alert("1.Invalid E-mail ID")//@not come,first char is @ or len @ is last char
-
return false
-
}
-
-
if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
-
alert("2.Invalid E-mail ID")
-
return false
-
}
-
-
if (str.indexOf(at,(lat+1))!=-1)//when more @ come together
-
{
-
alert("3.Invalid E-mail ID")
-
return false
-
}
-
-
if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot)//@. or .@ not come tgthr or
-
{
-
alert("4.Invalid E-mail ID")
-
return false
-
}
-
-
if (str.indexOf(dot,(lat+2))==-1)//if . is not come after @abc eg:meg@abc(is false)meg@ad(false)meg@gmail.com(correct)
-
{
-
alert("5.Invalid E-mail ID")
-
return false
-
}
-
-
if (str.indexOf(" ")!=-1){
-
alert("6.Invalid E-mail ID")
-
return false
-
}
-
-
return true
-
}
-
-
function ValidateForm(){
-
alert("fn");
-
var emailID=document.frmSample.txtEmail
-
var name=document.frmSample.txtname
-
if ((emailID.value==null)||(emailID.value=="")){
-
alert("Please Enter your e mail")
-
emailID.focus()
-
return false
-
}
-
if (echeck(emailID.value)==false){
-
emailID.value=""
-
emailID.focus()
-
return false
-
}
-
if ((name.value==null)||(name.value=="")){
-
alert("Please Enter your name")
-
emailID.focus()
-
return false
-
}
-
-
return true
-
}
-
</script>
-
-
<?php
-
$result="";
-
$sql1="";
-
include_once("includes/config.php");
-
$tableobj=new dataBase();
-
if(isset($_POST['Submit']))
-
-
{/*value="<?php if($_REQUEST['name']){ echo $_REQUEST['name']; } ?>"*/
-
-
$name=mysql_escape_string(trim($_POST['txtname']));
-
$emailid=trim($_POST['txtEmail']);
-
echo $name;
-
$result="SELECT * FROM admin WHERE (Admin_username)='".$name."'";
-
$row=$tableobj->selectQry($result);
-
$p=count($row);
-
echo $p;
-
echo"******";
-
$no=0;
-
for($i=0;$i<count($row);$i++)
-
{
-
$no++;
-
-
echo $no;
-
echo"#######";
-
}
-
-
-
-
if($no==0)
-
{
-
-
$sql1="INSERT INTO admin(Admin_name,Admin_username,Admin_passwd,email_id) VALUES('kamal','".$name."','megha','".$emailid."')";
-
if(!mysql_query($sql1,$con))
-
{
-
echo"error".mysql_error();
-
-
}
-
-
mysql_close($con);
-
}
-
if($no>0)
-
{
-
echo"username existing";
-
//header("location:email.php");
-
//exit();
-
-
}
-
}
-
-
-
?>
-
<body>
-
<form name="frmSample" method="post" action="email.php" onSubmit="return ValidateForm()">
-
<p>Enter name :
-
<input type="text" name="txtname" >
-
</p>
-
<p>
-
-
</p>
-
<p>Enter an Email Address :
-
<input type="text" name="txtEmail">
-
</p>
-
-
-
-
<input type="submit" name="Submit" value="Submit">
-
</p>
-
</form>
-
</body>
-
</html>
-
1 1394
Line 66 above. It looks like you're setting the emailid to "" (blank string).
Don't you want to take that out?
I don't see any other "content" besides that.
You should understand every line of your code, if not ask us or google it. There's no point in listing your problems if you don't know what your own program does, right?
Good luck,
Dan
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Nick Evans |
last post by:
Hello there,
I have been on and off learning to code (with python being the second
language I have worked on after a bit of BASIC). What I really want to know
is, if you are going to actually...
|
by: Zheng Da |
last post by:
I don't know where should I ask the question, so send the email to this
group.
I choose this group, because I want to write the program with c++ :)
I want to write a program which support...
|
by: brian.digipimp |
last post by:
I turned this in for my programming fundamentals class for our second
exam. I am a c++ newb, this is my first class I've taken. I got a good
grade on this project I'm just wondering if there is a...
|
by: Randy Yates |
last post by:
Hi,
I work in an embedded environment in which we often use a mix of C and
assembly code. Thus a recurring requirement is to be able to take a C
header file with structure definitions as input...
|
by: |
last post by:
Hi,all
I want to change Control's size&location in runtime ,(C#)
but i dont know how to do! :(so, can you provide me
with document about this.
my email: zhonghua@rinpak.com.cn ...
|
by: MS Newsgroups |
last post by:
Hi,
I am trying to create a table that adds cells through a for each loop. In
each cell i would like to create a image control. I have manged to get the
control created, but my problem is how to...
|
by: pealy2 |
last post by:
Sorry if this is in the wrong group, I've searched long & hard without
finding anything even slightly useful. (recommendations for a more
relevant group gratefuly received)
I need to change the...
|
by: Dave Smithz |
last post by:
Hi there,
Summary:
I'm looking for a good open source, Windows Change control program. What are
people using for there PHP projects? Is there a clear leader for this? Can
programs like MS...
|
by: trungthanh78 |
last post by:
Hello everyone,
I'm totally new to the group and I would like to learn from you. Thank
you in advance!
I need to write a program to track whether a mathematical function has
changed during...
|
by: John Scheldroup |
last post by:
Source:
Article
Mixing C and C++ Code in the Same Program
By Stephen Clamage, Sun Microsystems,
Sun ONE Studio Solaris Tools Development Engineering
...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |