Forum: Ruby on Rails SOS, how to get the parameters introduced in a form

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
burbu (Guest)
on 2007-03-14 19:49
I'm studying at university and I have being asked to do an application
with ruby on rails that given a web page where you have to subscribe
introducing some information in a form, later, after registering, you
can see the data introduced and advising the user that he has been
correctly subscribe.
The problem is that I don't know a lot about ruby on rails, I know I
must have my own data base but I have some questions. First of all, what
should I have in the controller and what for? Because I have put this:

class PrincipalController < ApplicationController
  def form
    render_text "Hola a todos"
  def enviaDades
    @subscriptor = @params[:subscriptor]
    @addr = @params[:address]
        @ciutat = @params[:ciutat]
        @cpostal = @params[:cpostal]
        @tcnum = @params[:tcnums]
        @dcaduc = @params[:dcaduc]
        @cc = @params[:cc]

        redirect_to :action => 'form2'

Is that correct??

Which are the different data I have in my data base. Know the problem,
is that I don't know what should I do next, to make the user see that
parameters and the advise telling him that all was correct. I have put
something like this, but i don't know how to show the parameters.

<title> Subscripci&oacute; Enwebats: Comformaci&oacute; </title>
<body bgcolor=white>
<h3> S'ha cursat la seva sol.licitud amb les dades:</h3>
<table border=0 width=50%>
  <%print @subscriptor%>
  <%print @addr%>


If it helps, here is the code of the web page where the form is:
<title> Subscripci&oacute; Enwebats: Comformaci&oacute; </title>
<body bgcolor=white>
  Nom: <INPUT NAME="subscriptor" SIZE=57> <P>
  Adre&ccedil;a: <INPUT NAME="address" SIZE=57> <P>
  Ciutat: <INPUT NAME="ciutat" SIZE=32>
  Codi Postal: <INPUT NAME="cpostal" SIZE=5> <P>
  N&uacute;m. Tarjeta Cr&egrave;dit: <INPUT NAME="tcnum" SIZE=19>
  Caduca: (MM/AA) <INPUT NAME="dcaduc" SIZE=5> <P>
  Tapes Enquadernables (+10 euros) <INPUT NAME="tapes" TYPE=CHECKBOX><P>

  <INPUT TYPE="submit" VALUE="Envia Dades">


Alex W. (Guest)
on 2007-03-14 21:04
burbu wrote:
> I have put
> something like this, but i don't know how to show the parameters.
>   <%print @subscriptor%>
>   <%print @addr%>

Use <%= @my_var %> to show variables form the controller.
This topic is locked and can not be replied to.