EasyCFM.COM ColdFusion Forums / Coding Help! / Forms

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: Forms -- page: 1 2

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts first

specific
04-25-2006 @ 2:44 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 897
Joined: Apr 2006

I never got Problems with forums, but this Time, I habe a form fields which are creating an obstacle in my way, I want to insert he items in the database, upon checking of the username, password and cirfirm password and all relevant fields, but It checks for one error and skips all other fields, and directly enters the data in the database with null values, help me outta this, the code of the form and processing page is below:

form.cfm page

<form method="POST" action="new_0.cfm">
  <table width="350" border="0" align="center" cellpadding="2">
    <tr>
      <td colspan="3" nowrap><div align="center" class="legal style1"><strong>. : Registration : . </strong></div></td>
    </tr>
    <tr>
      <td colspan="3" nowrap> </td>
    </tr>
    <tr>
      <td colspan="3" nowrap><div align="center">
       <cfif action IS "p">
       Password Mismatch
       <cfelseif action IS "f1">
       Your real Name Required
       <cfelseif action IS "l">
       Email Address not Valid
       <cfelseif action IS "i">
       Image Verification failed
       <cfelseif action IS "a">
       Username Already taken
       <cfelseif action IS "r">
       Thanks For registering
       </cfif>
       </div></td>
    </tr>
    <tr>
      <td align="right" nowrap class="sidebar"> Name : </td>
      <td colspan="2" nowrap>
       <input name="fullname" type="TEXT" size="20" maxlength="35" ></td>
    </tr>
    <tr>
      <td width="121" nowrap>
        <div align="RIGHT" class="sidebar">User :</div>      </td>
      <td colspan="2" nowrap><input name="username" type="TEXT" size="20" maxlength="20">      </td>
    </tr>
    <tr>
      <td nowrap>
        <div align="RIGHT" class="sidebar">Email :</div>      </td>
      <td colspan="2" nowrap><input name="email" type="TEXT" size="20" maxlength="35">      </td>
    </tr>
    <tr>
      <td align="right" nowrap class="sidebar">Password :</td>
      <td colspan="2" nowrap><input name="password" type="PASSWORD" size="20" maxlength="20"></td>
    </tr>
    <tr>
      <td nowrap>
        <div align="RIGHT" class="sidebar">Confirm Password : </div>      </td>
      <td colspan="2" nowrap><input name="password2" type="PASSWORD" size="20" maxlength="20">      </td>
    </tr>
    <tr>
      <td valign="top" nowrap>
        <div align="RIGHT" class="sidebar">Comments:</div>      </td>
      <td colspan="2" nowrap>
       <textarea name="comments" cols="30" rows="6" wrap ="VIRTUAL"></textarea></td>
    </tr>
    
    <tr>
      <td nowrap> </td>
      <td colspan="2" nowrap>
        <div align="LEFT">
          <input type="SUBMIT" value="Submit">
          <input name="RESET" type="RESET" value="Reset" />
        </div>      </td>
      </tr>
  </table>
</form>


here is Processing.cfm

<!--- Email Validation Goes Here --->
<cfset dot = 0>
<cfset at2 = 0>
<cfset at = Find("@",Form.email)>
<cfif at GT 0>
     <cfset at2 = Find("@",Form.email,at+1)>
     <cfset dot = Find(".",Form.email,At+1)>
</cfif>

<cfif  Not IsDefined("form.fullname")>
     <cflocation addtoken="no" url="new.cfm">
<cfelseif Not IsDefined("form.username")>
     <cflocation addtoken="no" url="new.cfm">
<cfelseif Not IsDefined("form.password")>
     <cflocation addtoken="no" url="new.cfm">
<cfelseif Not IsDefined("form.email")>
     <cflocation addtoken="no" url="new.cfm">
<cfelseif Not IsDefined("form.comments")>
     <cflocation addtoken="no" url="new.cfm">

<cfelse>
<cfquery datasource="#dbsource#" name="check"
username="#dbsource_username#" password="#dbsource_password#">
select username,email from login
where username = '#form.username#'
</cfquery>
     <cfquery datasource="#dbsource#"
               username="#dbsource_username#" password="#dbsource_password#">
                      INSERT INTO login (username, password, password2,
                    email, FullName, Comments) VALUES (
                    '#FORM.username#','#FORM.password#',
                    '#FORM.password2#','#FORM.email#',
                     '#FORM.fullname#','#FORM.comments#')
                      </cfquery>
     <cflocation url="new.cfm?action=r" addtoken="no">
     </cfif>

PAGE: 1 2

Website Designed and Developed by Pablo Varando.