Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need to retrieve and update fields in a form

Status
Not open for further replies.

sree

Programmer
Jul 10, 2000
10
0
0
US
hello <br><br>I tried to retrieve the values from database to a form, to modify the existing account, but am getting all the records not the one whom i request, can u pls.help am attaching code here <br><br>i had three files <br><br>1) login.htm 2) action.cfm (for checking the validity) 3) loginvalid.cfm (to retrieve specified user from database) <br><br>if u click on login button from login.htm page the if user exists it'll pass to the loginvalid.cfm if not it goes to action.cfm <br><br>am attaching the code of loginvalidity.cfm <br><br>do i need to use a hidden variable..if so tell me.how<br><br>am attaching my code of third form..ie., loginvalidity.cfm<br><br>============================================================<br><br>Attachments: &lt;cfquery name=&quot;retrieve&quot; datasource=&quot;bubblegum&quot;&gt;<br>&nbsp;select *from userinfo,userdetails where userinfo.username=userdetails.username<br>&nbsp;&lt;/cfquery&gt;<br><br>&lt;input type=&quot;text&quot; name=&quot;user&quot; value= &quot;#username#&quot;<br>&lt;input type= &quot;text&quot; name=&quot;pass&quot; value= &quot;#password#&quot;<br><br>but am getting all the records not the one<br><br>kindly rectify this..<br><br>&nbsp;<br>
 
I'm assuming that the user has filled out a username and password in the login.htm page....<br><br>In your select statement use<br><br>select * from userinfo,userdetails where userinfo.username=userdetails.username and userinfo.username='#form.user#' and userinfo.pass='#form.pass#'<br>
 
sorry darkman may be am mistaken<br><br>&nbsp;&nbsp;i need to send those login and password values to another form which user has to modify his details, can u tell me how to pass that username and password to another form, which user had filled.<br><br><br>regards<br>sreedhar
 
Assuming they've filled out a form with their username and password, the above select statement should give you the record.&nbsp;&nbsp;If that info is coming from a session variable, or some other means, just change the '#form.user#' and '#form.pass#' to whatever variable hold that info...<br><br>The input boxes you showed:<br><FONT FACE=monospace><b>&lt;input type=&quot;text&quot; name=&quot;user&quot; value= &quot;#username#&quot;<br>&lt;input type= &quot;text&quot; name=&quot;pass&quot; value= &quot;#password#&quot;</b></font><br>are missing the &gt; at the end, which will cause problems in your output.&nbsp;&nbsp;Also, you should qualify the value portion like:<br><FONT FACE=monospace><b><br>&lt;cfoutput&gt;<br>&lt;input type=&quot;text&quot; name=&quot;user&quot; value= &quot;#retrieve.username#&quot;&gt;<br>&lt;input type= &quot;text&quot; name=&quot;pass&quot; value= &quot;#retrieve.password#&quot;&gt;<br>&lt;/cfoutput&gt;<br></b></font><br>or<br><FONT FACE=monospace><b><br>&lt;cfoutput query=&quot;retrieve&quot;&gt;<br>&lt;input type=&quot;text&quot; name=&quot;user&quot; value= &quot;#username#&quot;&gt;<br>&lt;input type= &quot;text&quot; name=&quot;pass&quot; value= &quot;#password#&quot;&gt;<br>&lt;/cfoutput&gt;</b></font><br><br>If you'd rather these variables not show, do it like:<br><FONT FACE=monospace><b>&lt;cfoutput&gt;<br>&lt;input type=&quot;hidden&quot; name=&quot;user&quot; value= &quot;#retrieve.username#&quot;&gt;<br>&lt;input type= &quot;hidden&quot; name=&quot;pass&quot; value= &quot;#retrieve.password#&quot;&gt;<br>&lt;/cfoutput&gt;</b></font><br><br>Hope this helps....<br><br>DM
 
thanq darkman<br><br>&nbsp;&nbsp;&nbsp;anyway i had completed by passing url parameter, <br><br>&nbsp;&nbsp;&nbsp;&lt;cflocation = &quot;loginvalid.cfm?username=#form.username#&gt;<br><br>&nbsp;it worked<br><br>&nbsp;&nbsp;&nbsp;&nbsp;is this better of hidden fields r better<br><br>&nbsp;thanq<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top