Help with code

Hi everybody, first at ll sorry if my english is not the best. I’m
trying to implement this javascript in my aplication:

It´s a simple start rating implemented with javascript. There´s no
problem because I put it in public/javascripts and i can call them in my
application.html.rb but there´s one problem. I have this in my view:

.
.
.

" />
    <input name="submit" type="submit" value="Votar" />
</form>
<?php if(isset($_POST)): echo("Value is: ".$_POST["input-rating"]); endif ?>

.
.
.
I don´t know PHP, and I understant this lines:

<?php if(isset($_POST)): echo("Value is: ".$_POST["input-rating"]); endif ?>

Anybody that works with PHP too can says me the equivalence for rails??

On Thu, 26 Mar 2009 18:05:54 +0100
Jose vicente Ribera pellicer [email protected] wrote:

I don´t know PHP, and I understant this lines:

<?php if(isset($_POST)): echo("Value is: ".$_POST["input-rating"]); endif ?>

Anybody that works with PHP too can says me the equivalence for rails??

Post parameters are available in the view via the params method. Are you
seriously trying to put PHP code in your views? Or do you want to port
the php to ruby?

SH


Starr H.
Check out my Helpdesk RailsKit: http://railskits.com/helpdesk/

Are you
seriously trying to put PHP code in your views? Or do you want to port
the php to ruby?

SH

I want to port the php, but i am a begginer developper and i only
program with RoR. I don’t know how to port it to my rails application :frowning:

Jose vicente Ribera pellicer wrote:

Are you
seriously trying to put PHP code in your views? Or do you want to port
the php to ruby?

SH

I want to port the php, but i am a begginer developper and i only
program with RoR. I don’t know how to port it to my rails application :frowning:

I try with this:

<%- if(isset($_POST)): echo("Value is: ".$_POST[“input-rating”]); endif
%>

but firefox shows me this error:
SyntaxError in Videos#show

Showing videos/show.html.erb where line #17 raised:

compile error
/Users/jose/mimandote.com/app/views/videos/show.html.erb:17: syntax
error, unexpected tGVAR
_erbout.concat(( if(isset($_POST)): echo("Value is:
".$_POST[“input-rating”]); endif ).to_s); _erbout.concat “\n”
^
/Users/jose/mimandote.com/app/views/videos/show.html.erb:17: syntax
error, unexpected ‘)’, expecting kEND
_erbout.concat(( if(isset($_POST)): echo("Value is:
".$_POST[“input-rating”]); endif ).to_s); _erbout.concat “\n”
^
/Users/jose/mimandote.com/app/views/videos/show.html.erb:35: syntax
error, unexpected $end, expecting ‘)’

Extracted source (around line #17):

14:
15:
16:
17: <%= if(isset($_POST)): echo("Value is: ".$_POST[“input-rating”]);
endif %>
18:
19:
20: var pValue = ‘<?= $_POST["input-rating"] ?>’;

:frowning: