Jump to content

member signup check that serial number exists in db then append that record


KattMama

Recommended Posts

I'm a newb but a quick learner so I'm hoping someone can help me.

I want to enter the serial numbers from my product into a database, then allow customers access to a hidden part of the website when they register using one of these serial numbers.  I've been able to get the form to check the serial number against the database and give an error if the serial number doesn't exist, but when it does exist, I can't get it to append the rest of the users information to the record. It doesn't seem like it's even processing the rest of the form (which works fine when I take out the part about checking the sernum). 

At this point, I wouldn't even mind if it created a new record (although I have the sernum as the primary key so I guess I would need to change the database layout first).  Any help appreciated!!

Here's what I have:

[code]<?
if(isset($todo) and $todo=="post"){

$status = "OK";
$msg="";

if(mysql_num_rows(mysql_query("SELECT sernum FROM 1_signup WHERE sernum = '$sernum'")))
$status= "OK";
else
{
$msg=$msg."Serial number not found in our database. Please try again or contact your sales representative.<BR>";
$status= "NOTOK";}

if(mysql_num_rows(mysql_query("SELECT email FROM 1_signup WHERE email = '$email'"))){
$msg=$msg."Email already exists. Please try another one<BR>";
$status= "NOTOK";}

if ( strlen($password) < 3 ){
$msg=$msg."Password must be more than 3 char length<BR>";
$status= "NOTOK";}

if ( $password <> $password2 ){
$msg=$msg."Both passwords are not matching<BR>";
$status= "NOTOK";}

if ( strlen($sernum) < 1 ){
$msg=$msg."You must enter your Serial Number<BR>";
$status= "NOTOK";}

if ($agree<>"yes") {
$msg=$msg."You must agree to terms and conditions<BR>";
$status= "NOTOK";}

if($status<>"OK"){
echo "<font face='Verdana' size='2' color=red>$msg</font><br><input type='button' value='Retry' onClick='history.go(-1)'>";
}else{
$query=mysql_query("insert into 1_signup(email,password,name,sernum) values('$email','$password','$name','$sernum')");
echo "<font face='Verdana' size='2' color=green>Welcome, You have successfully signed up<br><br><a href=login.php>Click here to login</a><br></font>";
}
}
?>[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.