Hi,
I've got this code here for entering data from a flash form into a mysql database - which works fine except that it puts 2 entries into the data base one just with the date and eveything else blank and one which has all the relevant infomation?
Any one tell me what is wrong?
Many Thanks in advance.
R.
require 'incLoc.php';
$Connect = mysql_connect($DBhost,$DBuser,$DBpass);
mysql_select_db("$DBName");
$joindate = date("m/d/Y H:i:s");
$fname=$POST['fname'];
$lastname=$POST['lname'];
$bname=$POST['bname'];
$type=$POST['type'];
$ad=$POST['ad'];
$count =$POST['count'];
$pcode=$POST['pcode'];
$mail=$POST['mail'];
$telno=$POST['telno'];
$website=$POST['website'];
$det=$POST['det'];
$password=$POST['pass1'];
$online=$_POST['online'];
$query = "SELECT * FROM members WHERE Email = '$mail'";
$result = mysql_query($query);
//
$numR = mysql_num_rows($result);
//
if ($numR == 1) {
print "answer=This email address is already registered, if you have forgotten your password click below";
}
else {
$query = "INSERT INTO members (No, Name, LastName, BandName, Type, Address, County, PostCode, Email, Tel, WebSite, Details, JoinDate, Paid, Password, Online, Visits, VisitDate) VALUES ('', '$fname', '$lastname','$bname', '$type', '$ad', '$count', '$pcode', '$mail', '$telno', '$website', '$det', '$joindate', '', '$password', '$online', '1','$joindate')";
$result = mysql_query($query);
// Gets the number of rows affected by the query as a check.
$numR = mysql_affected_rows($Connect);
if ($numR == 0) {
print "answer=Sorry a technical error has occurred Please Fill out all Fields Again";
}
else if ($numR == 1) {
print "answer=Thankyou you are now a member of 'The Avant Guilds Performing Arts Society'. You will receive an e-mail shortly with confirmation of your password and details.";
require 'mailform.php';
}
else { print "answer=General Error - Sorry - Try Again";
}
}