Yii Framework Forum: Retrieve data from layout - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Retrieve data from layout Rate Topic: -----

#1 User is offline   Kmsitu 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 26-January 12

Posted 26 January 2012 - 05:40 AM

Hello,

I'd would like to ask an easy and fast question because I've been searching for 2 days now and can't find a solution.

If I have a form in the layout/main.php (login form), how and where can I process its data?

layout/main.php:

Quote

<form action="/prova/index.php/login" method="POST" name="LoginForm">
<input class="input-small" type="text" placeholder="Email">
<input class="input-small" type="password" placeholder="Password">
<button class="btn" type="submit">Login</button>
</form>


I mean, as you can see there is the attribute action="/prova/index.php/login" because I would like to capture an process the data in my LoginController, but I print POST ( print_r($_POST); ) and its empty.

Any help would be appreciated.

Thanks in advance.
0

#2 User is offline   Weavora Team 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 141
  • Joined: 06-December 10

Posted 27 January 2012 - 06:37 AM

It's because you have no `name` attributes into inputs.

<form action="/prova/index.php/login" method="POST" name="LoginForm">
<input class="input-small" type="text" placeholder="Email" name="Email">
<input class="input-small" type="password" placeholder="Password" name="Password">
<button class="btn" type="submit">Login</button>
</form>

0

#3 User is offline   tri 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,651
  • Joined: 20-November 08
  • Location:Stockholm, Sweden

Posted 27 January 2012 - 07:28 AM

/* moved - not specific to Yii */
Don't forget to read The Definitive Guide to Yii (en) (sv) | The class reference has the details
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users