Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Email Activation For Registration Forms

  • This topic is empty.
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #29608
    allampatu
    Participant

    hi guys
    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

    Code:

    thanks for your help guys

    #79708
    allampatu
    Participant

    i’ve tried every solution on comments but i can’t still figure out

    #79728

    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)" .
    "VALUES(‘".$image."’) ";
    mysql_db_query($db, $sql);

    Please assign all the values like this, now the values will insert the database only one time… :D

    #79817
    allampatu
    Participant

    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

    Code:
    <form class="form" action="verify.php" method="post">
    <p>
    <label>First name
    <input type="text" name="firstname" id="firstname" />
    </label>
    </p>
    <p>
    <label>Last name
    <input type="text" name="lastname" id="lastname" />
    </label>
    </p>
    <p>
    <label>Job Title
    <input type="text" name="jobtitle" id="jobtitle" />
    </label>
    </p>
    <p>
    <label>Organization
    <input name="organization" type="text" id="organization" cols="45" rows="5"></textarea>
    </label>
    </p>
    <p>
    <label>Describe your organization in 100 words<br />
    <textarea name="describeorg" id="describeorg" cols="30" rows="5"></textarea>
    </label>
    </p>
    <p>
    <label>Who to meet at the conference<br />
    <textarea name="meet" id="meet" cols="30" rows="5"></textarea>
    </label>
    </p>
    <p>
    <label>Email
    <input type="text" name="email" id="email" />
    </label>
    </p>
    <table width="497">
    <tr>
    <td width="162">&nbsp;</td>
    <td width="299">accept to be audio/video recorded<br />
    and participation to the event made public</td>
    <td width="20" align="center"><input type="checkbox" name="accept" id="accept" /></td>
    </tr>
    </table>
    </p>
    <table width="496">
    <tr>
    <td width="270" rowspan="2" align="left">&nbsp;</td>
    <td width="161" rowspan="2" align="left">need special assistance (e.g. wheelchair accessible)</td>
    <td width="49" align="right">no <input type="radio" name="noassistance" value="no" id="RadioGroup1_0" /></td>
    </tr>
    <tr>
    <td align="right">yes <input type="radio" name="yesassistant" value="yes" id="RadioGroup1_1" /></td>
    </tr>
    </table>
    <p>
    <label>
    <input type="submit" name="submit" id="submit" value="Register" />
    </label>
    </p>
    </form>

    and my verify.php code

    Code:
    <?php
    $firstname=$_POST[’firstname’];
    $lastname=$_POST[’lastname’];
    $jobtitle=$_POST[’jobtitle’];
    $organization=$_POST[’organization’];
    $describeorg=$_POST[’describeorg’];
    $meet=$_POST[’meet’];
    $email=$_POST[’email’];
    $accept=$_POST[’accept’];
    $noassistance=$_POST[’noassistance’];
    $yesassistance=$_POST[’yesassistance’];

    $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

    Code:

    — MySQL 4.1.22
    — Thu, 15 Jul 2010 17:33:50 +0200

    CREATE TABLE `participants` (
    `ID` int(10) not null default ‘0’,
    `firstname` varchar(20),
    `lastname` varchar(20),
    `jobtitle` varchar(20),
    `organization` varchar(20),
    `describeorg` varchar(100),
    `meet` varchar(100),
    `email` varchar(20),
    `noassistance` char(2),
    `yesassistance` char(2),
    PRIMARY KEY (`ID`)
    ) ENGINE=MyISAM DEFAULT CHARSET=latin1;

    — [Table `participants` is empty]

    #79856
    Tcooper
    Member

    Instead of returning ‘error’ when it fails, check mysql_error() – that way you can actually see why it’s failing.

    #79865
    allampatu
    Participant

    ok now i know a new command!

    i wrote mysql_query($query) or die (mysql_error())

    and i get this error, Unknown column ‘ID’ in ‘field list’

    where am i wrong?

    #79866
    Rob MacKay
    Participant

    you are probably calling your ID column in upper case and the col name is actually in lower case. It is something like that. Else the ID col dosen’t exist at all :D

    #79897
    allampatu
    Participant
    "Robskiwarrior" wrote:
    you are probably calling your ID column in upper case and the col name is actually in lower case. It is something like that. Else the ID col dosen’t exist at all :D

    you got it dude! :D

    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?

    thanks

    #80377
    allampatu
    Participant

    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?

    #107692
    nsunh96
    Member

    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!

Viewing 10 posts - 1 through 10 (of 10 total)
  • The forum ‘Back End’ is closed to new topics and replies.