Hi
I have a form with user details and credit card details.The user
details are entering into ''user'' table and credit card details
are
entering ''creditcard'' table.As the user entered his personnel
information and credit card details and click on submit button the
page posts all the variables into next page where user can conform his
details.By clicking on conform only the data are being entered into
user table and creditcard table. I need to pass the information from
one page to next as session varibles? can anyone please help me.
My code is like this in regiter_page(1stpage)
<% form_for :user, @user, :url => {:controller => "users",
:action =>
"register_paid_user" } do |user| %>
<table width="100%" border="0"
cellspacing="0"
cellpadding="0">
<tr>
<td width="35%"><img
src="/images/inner-table/
payment-information.gif" alt="Payment Information"
width="165"
height="33" /></td>
<td width="65%">
</td>
</tr>
</table>
<table width="100%" border="0"
cellpadding="0"
cellspacing="0" class="inner_tablemrg">
<tr>
<th width="35%"
class="left">User Information</
th>
<th width="65%"> </th>
</tr>
<tr>
<td width="35%"
class="dark_left">First Name:</
td>
<td width="65%"
class="dark"><%user.text_field :first_name, :class =>
"formfield", :size => "20" %></
td>
</tr>
<tr>
<td width="35%"
class="left">Last Name:</td>
<td width="65%"
class="dark"><%user.text_field :last_name, :class =>
"formfield", :size => "20" %> </
td>
</tr>
<tr>
<td width="35%"
class="dark_left">Email
Address:</td>
<td width="65%"
class="dark"><%user.text_field :email, :class =>
"formfield", :size => "20" %></td>
</tr>
</table>
<table width="100%" border="0"
cellpadding="0"
cellspacing="0" class="inner_tablemrg">
<tr>
<th width="35%"
class="left">Billing Name and
Address</th>
<th width="65%"> </th>
</tr>
<tr>
<td width="35%"
class="dark_left">Billing
Name:</td>
<td width="65%"
class="dark"><%user.text_field :billing_name, :class =>
"formfield", :size => "30"
%></td>
</tr>
<tr>
<td width="35%"
class="left">Billing Address:</
td>
<td width="65%"><%user.text_field
:address_line1, :class => "formfield", :size => "30"
%></td>
</tr>
<tr>
<td width="35%"
class="dark_left">Billing
Address 2:</td>
<td width="65%"
class="dark"><%user.text_field :address_line2, :class =>
"formfield", :size => "30"
%></td>
</tr>
<tr>
<td width="35%"
class="left">City, State/
Province and Postal Code:</td>
<td width="65%"><%user.text_field
:city, :class => "formfield", :size => "20" %>
<%= user.text_field :state, :class =>
"formfield", :size => "10" %>
<%= user.text_field :zip_code, :class =>
"formfield", :size => "5" %></td>
</tr>
<tr>
<td width="35%"
class="dark_left">Country:</
td>
<td width="65%" class="dark">
<%= user.country_select :country, ["United
States"], :size => "10" %></select></td>
</tr>
</table>
<%= render :partial => "credit_card_details" %>
<% hidden_field_tag "plan_type", @plan_type %>
<table width="100%" border="0"
cellpadding="0"
cellspacing="0" class="inner_tablemrg_clear">
<tr>
<td width="35%"
class="left"> </
td>
<td width="65%">
<%= image_submit_tag "/images/buttons/button-review-
subscription.gif", {:alt => "Review Subscription"} %>
(<a href="purchase_review">link</a>)</td>
</tr>
</table>
</div>
<% end %>
partial of the page
<% @user_cards = @user.user_cards %>
<% @user_cards.each do |c| %>
<table width="100%" border="0"
cellpadding="0" cellspacing="0"
class="inner_tablemrg">
<tr>
<% fields_for "user[user_card_attributes]", c do |user_card|%>
<th width="35%" class="left">Credit Card
Details</th>
<th width="65%"> </th>
</tr>
<tr>
<td width="35%" class="dark_left">Credit Card
Type:</td>
<td width="65%"
class="dark"><%user_card.text_field :type,:class =>
"formfield", :size =>
"20", :index => 0 %> </td>
</tr>
<tr>
<td width="35%" class="left">Card
Number:</td>
<td width="65%"
class="dark"><%user_card.text_field :cc_number, :class =>
"formfield", :size =>
"20",:index => 0 %> </td>
</tr>
<tr>
<td width="35%" class="dark_left">Expiration
Date:</td>
</td>
</tr>
<tr>
<td width="35%" class="left">Security
Code:</td>
<td width="65%"
class="dark"><%user_card.text_field :short_cc_number, :class
=> "formfield", :size =>
"20", :index => 0 %> </td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0"
cellspacing="0"
class="inner_tablemrg">
<tr>
<th class="left">Terms & Conditions</th>
</tr>
<tr>
<td class="dark_left"><textarea
name="textarea" cols="100"
rows="4" wrap="virtual"
class="formfield_small">Terms and
conditions...</textarea></td>
</tr>
<tr>
<td class="left"><input type="checkbox"
name="checkbox"
value="checkbox" />
I hereby agree to the above Terms and Conditions</td>
</tr>
</table>
<% end %><% end %>
my controller
def register_paid_user
@user = current_user
session[:user] = params[:user]
render :action => "register-purchase-review"
end
display page
<table width="100%" border="0" cellpadding="0"
cellspacing="0"
class="inner_tablemrg">
<tr>
<th width="35%"
class="left">User
Information</th>
<th width="65%"><img
src="/images/icons-
shlm/edit.gif" alt="Edit" width="11"
height="12" class="icon_middle" /> <a href="register_plan_type_payment">Change
This</a></th>
</tr>
<tr>
<td width="35%" valign="top"
class="left">User Details:</td>
<td width="65%"
valign="top"><
%=@user.first_name%> <%=@user.last_name%><br />
<%=@user.email%> <br />
</tr>
</table>
<table width="100%" border="0"
cellpadding="0" cellspacing="0"
class="inner_tablemrg">
<tr>
<th width="35%"
class="left">Billing Name
and Address</th>
<th width="65%"><img
src="/images/icons-
shlm/edit.gif" alt="Edit" width="11"
height="12" class="icon_middle" /> <a href="register_plan_type_payment">Change
This</a></th>
</tr>
<tr>
<td width="35%" valign="top"
class="left">Billing Details:</td>
<td width="65%"
valign="top"><
%=session[:user][:billing_name]%><br />
<%=session[:user][:address_line1]%>
<%=session[:user][:address_line2]%><br
/>
<%=session[:user][:city]%> <
%=session[:user][:state]%> <%=session[:user][:zip_code]%><br
/>
<%=session[:user][:country]%> </td>
</tr>
</table>
<table width="100%" border="0"
cellpadding="0" cellspacing="0"
class="inner_tablemrg">
<tr>
<th width="35%"
class="left">Credit Card
Details</th>
<th width="65%"><img
src="/images/icons-
shlm/edit.gif" alt="Edit" width="11"
height="12" class="icon_middle" /> <a href="register_plan_type_payment">Change
This</a></th>
</tr>
<tr>
<td width="35%" valign="top"
class="left">Card Number:</td>
<td width="65%"
valign="top"><
%=session[:user][:type]%><br />
<br />
</td>
</tr>
</table>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---