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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
A9de5876cfbc0afdaa5a1acf4247d9ae?d=identicon&s=25 burbu (Guest)
on 2007-03-14 18: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"
  end
  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'
      end
  end
end


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.


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

</table>
</body>
</html>


If it helps, here is the code of the web page where the form is:
<html>
<head>
<title> Subscripci&oacute; Enwebats: Comformaci&oacute; </title>
</head>
<body bgcolor=white>
<BR>
<FORM ACTION ="/EnWEBats/enviaDades" METHOD=POST>
  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>
  AMEX <INPUT NAME="cc" TYPE=RADIO VALUE="amex"> VISA <INPUT NAME="cc"
TYPE=RADIO VALUE="visa"> <P>
  Tapes Enquadernables (+10 euros) <INPUT NAME="tapes" TYPE=CHECKBOX><P>

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

</body>
</html>




Thanks.
D0cd6b10e01bacb976b3b815a9c660bc?d=identicon&s=25 Alex Wayne (squeegy)
on 2007-03-14 20: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.