# Help with code

**URL:** <https://www.ruby-forum.com/t/help-with-code/163988>\
**Category:** Rails\
**Created:** [March 26, 2009, 6:05pm UTC](https://www.ruby-forum.com/t/help-with-code/163988 "2009-03-26T18:05:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![chimorito](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/54ee81/32.png) [@chimorito](https://www.ruby-forum.com/u/chimorito)\
**Post date:** [March 26, 2009, 6:05pm UTC](https://www.ruby-forum.com/t/help-with-code/163988/1 "2009-03-26T18:05:54Z")

</div>

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

> **[Barra de calificación con estrellas (rating star) con JavaScript-YUI](https://www.ribosomatic.com/articulos/barra-de-calificacion-con-estrellas-rating-star-con-javascript-yui/)**
>
> Richard Healy de Gamma Tan ha creado un widget de calificación que utiliza YUI como soporte.  La versión 0.1.1 esta disponible para descargar. Es un widget estándar que pu…

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??

---

<div class="post-metadata">

**Author:** ![chimorito](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/54ee81/32.png) [@chimorito](https://www.ruby-forum.com/u/chimorito)\
**Post date:** [March 26, 2009, 6:34pm UTC](https://www.ruby-forum.com/t/help-with-code/163988/2 "2009-03-26T18:34:37Z")

</div>

On Thu, 26 Mar 2009 18:05:54 +0100  
Jose vicente Ribera pellicer [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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/](http://railskits.com/helpdesk/)

---

<div class="post-metadata">

**Author:** ![chimorito](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/54ee81/32.png) [@chimorito](https://www.ruby-forum.com/u/chimorito)\
**Post date:** [March 26, 2009, 6:53pm UTC](https://www.ruby-forum.com/t/help-with-code/163988/3 "2009-03-26T18:53:43Z")

</div>

> 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 ☹

---

<div class="post-metadata">

**Author:** ![chimorito](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/54ee81/32.png) [@chimorito](https://www.ruby-forum.com/u/chimorito)\
**Post date:** [March 26, 2009, 7:07pm UTC](https://www.ruby-forum.com/t/help-with-code/163988/4 "2009-03-26T19:07:52Z")

</div>

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 ☹

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"] ?\>’;

☹
