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| %>
User Information</ th> |
|
---|---|
First Name:</ td> |
<%= user.text_field :first_name, :class => “formfield”, :size => “20” %></ td> |
Last Name: | <%= user.text_field :last_name, :class => “formfield”, :size => “20” %> </ td> |
Email Address: |
<%= user.text_field :email, :class => “formfield”, :size => “20” %> |
Billing Name and Address |
|
Billing Name: |
<%= user.text_field :billing_name, :class => “formfield”, :size => “30” %> |
Billing Address:</ td> |
<%= user.text_field :address_line1, :class => “formfield”, :size => “30” %> |
Billing Address 2: |
<%= user.text_field :address_line2, :class => “formfield”, :size => “30” %> |
City, State/ Province and Postal Code: |
<%= 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” %> |
Country:</ td> |
<%= user.country_select :country, [“United States”], :size => “10” %> |
<%= 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”>
td>
<%= image_submit_tag “/images/buttons/button-review-
subscription.gif”, {:alt => “Review Subscription”} %>
(link)
<% end %>
partial of the page
<% @user_cards = @user.user_cards %>
<% @user_cards.each do |c| %>
Credit Card Details | |
---|---|
Credit Card Type: | <%= user_card.text_field :type,:class => "formfield", :size => "20", :index => 0 %> |
Card Number: | <%= user_card.text_field :cc_number, :class => "formfield", :size => "20",:index => 0 %> |
Expiration Date: |
Terms & Conditions |
---|
Terms and conditions... |
I hereby agree to the above Terms and Conditions |
my controller
def register_paid_user
@user = current_user
session[:user] = params[:user]
render :action => “register-purchase-review”
end
display page
User Information | Change This |
---|---|
User Details: | <
%[email protected]_name%> <%[email protected]_name%> <%[email protected]%>
cellspacing=“0” |
Billing Name and Address |
<img src="/images/icons- shlm/edit.gif" alt=“Edit” width=“11” height=“12” class=“icon_middle” / |
Billing Details: | < %=session[:user][:billing_name]%> <%=session[:user][:address_line1]%> <%=session[:user][:address_line2]%> <%=session[:user][:city]%> < %=session[:user][:state]%> <%=session[:user][:zip_code]%> <%=session[:user][:country]%> |
Credit Card Details |
<img src="/images/icons- shlm/edit.gif" alt=“Edit” width=“11” height=“12” class=“icon_middle” / Change This |
---|---|
Card Number: | < %=session[:user][:type]%> |