• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

WHERE CLAUSE

Guest
May 28, 2006 May 28, 2006

Copy link to clipboard

Copied

Hi can someone help me i have a output of names with a button next to each of them, when the form is submited i have a action page that inserts information into a table

the problem i have is when the form is submitted the whole output is being put into one record and they should be seperate records for each output row, i know i need to put a where clause in but not sure how to?

EG
name 1 submit
name 2 submit

so if i click submit next to name 1 only name 1 will be inserted into the table

**FORM**
<form name="form1" method="post" action="insertnewmember.cfm">
<tr>
<td><strong>Users Name </strong></td>
<td><div align="left"><strong>Type of User </strong></div></td>
<td><div align="center"><strong>Authorise This User </strong></div></td>
</tr>
<cfoutput query="Gettuserslist">
<tr>
<td width="276" height="31"> #Gettuserslist.Name#
<input type="hidden" name="Name" value="#Gettuserslist.Name#">
<input type="hidden" name="EmailAddress" value="#Gettuserslist.EmailAddress#">
<input type="hidden" name="Password" value="#Gettuserslist.Password#">
<input type="hidden" name="ID" value="#Gettuserslist.TempID#">
</td>
<td width="109"><div align="left">
<select name="Type">
<option>User</option>
<option>Aministrator</option>
</select>
</div></td>
<td width="72"><div align="center">
<input name="submit" type="submit" value="Authorise">
</div></td>
</tr>
<tr>
<td height="20"> </td>
<td> </td>
<td> </td>
</tr>
</cfoutput>
</form>

**ACTION**
<cfquery name="Insertuser2" datasource="Cricket">
INSERT INTO PlayersList_Table
(PlayersName, Email, Username, Password, Type)
VALUES
('#form.Name#', '#form.EmailAddress#', '#form.EmailAddress#', '#form.Password#', '#form.Type#')
</cfquery>
TOPICS
Advanced techniques

Views

249

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 28, 2006 May 28, 2006

Copy link to clipboard

Copied

The Problem you are haiving is that on your form had for example 15 hidden values called "name" that is why it is inserting them all in one entry as perhaps, john,johan,mandy etc.

You will have to make the=m dynamic like
in your aotput statement, create variable counter and add 1
cfinput type hidden name="Name#counter#"

than on the action page check if more than i name is supplied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 28, 2006 May 28, 2006

Copy link to clipboard

Copied

hi thanks

is this all i need to add?
<input type="hidden" name="Name#counter#">

or does it need a value? if so how do i create a counter

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 28, 2006 May 28, 2006

Copy link to clipboard

Copied

LATEST
i have got a better idea for you. rather do this to your code, it will create an individual form, for each person, and you leave your action page as is
forgot inside query, set counter = counter+1
add above form field
hope this works

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation