|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
I have passed parameters from form 1 to form 2 successfully but when I submit from page2 it doesn't add the text to the SQL database.
Page2: (This does get the parameters from page1 ok) <cfset CurrentPage=GetFileFromPath(GetTemplatePath())> <cfif IsDefined("FORM.MM_InsertRecord") AND FORM.MM_InsertRecord EQ "userSignup1"> <cfquery datasource="bernada_golf"> INSERT INTO dbo.tbPlanetLogin (emailaddress, firstname, lastname) VALUES ( <cfif IsDefined("FORM.emailaddress") AND #FORM.emailaddress# NEQ ""> '#FORM.emailaddress#' <cfelse> NULL </cfif> , <cfif IsDefined("FORM.firstname") AND #FORM.firstname# NEQ ""> '#FORM.firstname#' <cfelse> NULL </cfif> , <cfif IsDefined("FORM.lastname") AND #FORM.lastname# NEQ ""> '#FORM.lastname#' <cfelse> NULL </cfif> ) </cfquery> </cfif> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> Page 2<p> <cfoutput> <form name="userSignup1" action="<cfoutput>#CurrentPage#</cfoutput>" method="post"> Data from form 1: #form.emailaddress#<br> Data from form 1: #form.firstname#<br> Data from form 1: #form.lastname#<br> Data from form 1: #form.password#<br> <input type="hidden" name="emailaddress" value="#form.emailaddress#"> <input type="hidden" name="firstname" value="#form.firstname#"> <input type="hidden" name="lastname" value="#form.lastname#"> <input type="hidden" name="password" value="#form.password#"> <input type="submit" value="Sign up"> </form> </cfoutput> </body> </html> |
|
#2
|
||||
|
||||
|
What your doing looks ok.
Try removing the validating of the form values and just assume that they are ok (or just do a quick cfoutput of them) it would probably be a lot cleaner code as well if your just used cfparam to set the default values of your form values to null instead of having a bunch of if statements in your query. |
|
#3
|
|||
|
|||
|
still having problems
If I leave <cfoutput> tags around the hidden fields it puts #form.emailaddress# for example into the database. If I remove the <cfoutput> tags it doesn't put anything in the database.
Is there something else I can use instaed of #form.emailaddress# for the value in the hidden field or has anyone got any other suggestions. Cheers peter Form code: <form name="userSignup1" action="<cfoutput>#CurrentPage#</cfoutput>" method="post"> <cfoutput> <input type="hidden" name="emailaddress" value="#form.emailaddress#"> <input type="hidden" name="firstname" value="#form.firstname#"> <input type="hidden" name="lastname" value="#form.lastname#"> <input type="hidden" name="password" value="#form.password#"> </cfoutput> <input type="submit" value="Sign up"> <input type="hidden" name="MM_InsertRecord" value="form1"> </form> |
|
#4
|
|||
|
|||
|
In case this is of use to other developers the solution is uou must have the <cfoutput> tags outside the form. Then it works ok.
![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > adding to database using info from form 1 |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|