Link to home
Start Free TrialLog in
Avatar of goldiebugs
goldiebugs

asked on

passing an id from a query to an a tag

<cfif '#form.email#' is not ''>
<cfquery name="validate" datasource="#dsn#">
SELECT           *
FROM           tablename
WHERE           email = '#form.email#'
AND          password = '#form.password#'
</cfquery>

<!--- i want to take the id from the table and use it in the a tag below for edit. how can i do this? --->

<table width="300" align="center" border="0" cellpadding="1" cellspacing="1">
 <tr>
  <td>a href="editpage.cfm?act=edit&id=#id#">Edit page</a></td>
 </tr>
 <tr>
  <td>a href="send.cfm?id=#url.id#">Apply</a></td>
 </tr>
 </tr>
</table>
Avatar of Wasistdas
Wasistdas


<cfif '#form.email#' is not ''>
<cfquery name="validate" datasource="#dsn#">
SELECT           *
FROM           tablename
WHERE           email = '#form.email#'
AND          password = '#form.password#'
</cfquery>

<!--- i want to take the id from the table and use it in the a tag below for edit. how can i do this? --->

<table width="300" align="center" border="0" cellpadding="1" cellspacing="1">
<tr>
 <td><cfoutput><a href="editpage.cfm?act=edit&id=#validate.id#">Edit page</a><cfoutput></td>
</tr>
<tr>
 <td><cfoutput><a href="send.cfm?id=#validate.id#">Apply</a><cfoutput></td>
</tr>
</tr>
</table>
ASKER CERTIFIED SOLUTION
Avatar of dash420
dash420
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of goldiebugs

ASKER

oh my - why didn't i think of that?

thank you so much. before posting this question, i tried what Wasistdas said, but that didn't work.

thank you so much!
I just forgot to slash <cfoutput>. The correct code is:

<cfif '#form.email#' is not ''>
<cfquery name="validate" datasource="#dsn#">
SELECT           *
FROM           tablename
WHERE           email = '#form.email#'
AND          password = '#form.password#'
</cfquery>

<!--- i want to take the id from the table and use it in the a tag below for edit. how can i do this? --->

<table width="300" align="center" border="0" cellpadding="1" cellspacing="1">
<tr>
<td><cfoutput><a href="editpage.cfm?act=edit&id=#validate.id#">Edit page</a></cfoutput></td>
</tr>
<tr>
<td><cfoutput><a href="send.cfm?id=#validate.id#">Apply</a></cfoutput></td>
</tr>
</tr>
</table>