i have this script to allow user registration with activation link. all data goes in a database.
the script works fine but when i add an user in my DB i see two records, the first one with the right data and the second one with a blank record.
if i don’t delete this record i can’t add more users, in my web page compare Error: Duplicate entry ” for key 2
this is the code that going me crazy
thanks for your help guys
I have just give you the sample coding format, It will be very useful for you
Code for Textbox
<input type="text" value="" name="sample" size="15"/>
Code for Posting the value
$sample = $_POST;
Code for Inserting the values in the database
$sql = "INSERT INTO profile(image)" .
Please assign all the values like this, now the values will insert the database only one time…
i’ve opted to build it from myself, i want learn php!
now i can’t understand why i can’t insert data into database, mysql_query function give me always error.
so this is my form
and my verify.php code
$username = "user";
$password = "pass";
$host = "localhost";
$database = "my_db";
$db = mysql_connect($host, $username, $password) or die("Errore durante la connessione al database");
mysql_select_db($database, $db) or die("Errore durante la selezione del database");
$query = "INSERT INTO participants ( ID, firstname, lastname, jobtitle, organization, describeorg, meet, email, accept, noassistance, yesassistance) VALUES (‘NULL’, ‘.$firstname’, ‘.$lastname’, ‘.$jobtitle’, ‘.$organization’, ‘.$describeorg’, ‘.$meet’, ‘.$email’, ‘.$accept’, ‘.$noassistance’, ‘.$yesassistance’)";
mysql_query($query, $db) or die (‘error’);
and at least my query for table
CREATE TABLE `participants` (
`ID` int(10) not null default ‘0’,
PRIMARY KEY (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
— [Table `participants` is empty]
you got it dude!
now my form with activation email works pretty well.
now i’ve added with the help of dreamweaver cs4 the spry validation field and it works fine too.
my last question is, could a form with required field and activation email avoid spam?
i must to embed a captcha field?
i would like embed a captcha sistem. it works but the required fields are like not required, so if complete only the captcha the form sent data with blank field.
I tried two different (reCAPTCHA google and another) but both have the same result.
solution at this point that I could invent?
The form works perfectly! I implemented this into a popup. However, once the person hits submit, they get the generic text “An email has been sent to THEIR EMAIL with an activation key. Please check your mail to complete registration.” I created a nice looking success page to replace this, but I don’t know how to code it in the PHP. Help!
You must be logged in to reply to this topic.