brakos
asked on
How to pass a variable from a recordset to another form using a button inside the form
hi
I built a simple query that retrieves some data.
Using that query (recordset1) I built with Dreamweaver MX 2004
a Dynamic Table that displays the recordset (name, surname, address).
It works fine so far.
All the dynamic table is placed inside a form and on the right side
of the dynamic table, I put in a cell, a button which will
allow me to load the book3.cfm when I click to it. For example if the
query returns 5 records, so on the right side 5 buttons will be displayed.
How can I pass a variable (for example the surname) from the recordset
on the next page (book3.cfm) and display it from the specific button i clicked ?
(well I actually want to use it so if I display it someway I can use it also)
I tried using a hidden field but then on the next page it displays always
the first name of the people retrieved and not actually the one I clicked :-(
I cannot understand that because the hidden field is placed outside the
dynamic table but inside the form (I tried it inside with and displayed all names hhahahah)
Thank you a lot.
I built a simple query that retrieves some data.
Using that query (recordset1) I built with Dreamweaver MX 2004
a Dynamic Table that displays the recordset (name, surname, address).
It works fine so far.
All the dynamic table is placed inside a form and on the right side
of the dynamic table, I put in a cell, a button which will
allow me to load the book3.cfm when I click to it. For example if the
query returns 5 records, so on the right side 5 buttons will be displayed.
How can I pass a variable (for example the surname) from the recordset
on the next page (book3.cfm) and display it from the specific button i clicked ?
(well I actually want to use it so if I display it someway I can use it also)
I tried using a hidden field but then on the next page it displays always
the first name of the people retrieved and not actually the one I clicked :-(
I cannot understand that because the hidden field is placed outside the
dynamic table but inside the form (I tried it inside with and displayed all names hhahahah)
Thank you a lot.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
so now you can get the info on your action page as #name# #surname# #address# or however you want to display it but it will be the info you click the button for.
regards,
~trail
regards,
~trail
ASKER
thanks guys
SELECT name, surname, address
FROM yourTable
</cfquery>
<FORM NAME="YourForm" ACTION="" METHOD="post">
<Table>
<TR>
<TD align="center">Name</TD>
<TD align="center">Last Name</TD>
<TD align="center">Address</TD
<TD align="center">Go</TD>
</TR>
<cfoutput query="YourQR">
<TR>
<TD>#name#</TD>
<TD>#surname#</TD>
<TD>#address#</TD>
<TD><input type="button" name="???" onclick="this.form.action = 'book3.cfm?name=#name#&sur
</TD>
</TR>
<cfoutput>
</Table>
</FORM>
This will submit what ever info you click on to the next page...
Hope that helps