Getting data values from form in Fat-Free framework

1,431 views
Skip to first unread message

xiao liu

unread,
Sep 24, 2015, 9:52:22 PM9/24/15
to Fat-Free Framework

I'm migrating from codeigniter to Fat-Free (F3) and trying to get my head around the quirks.


Regarding the following form:



  <form ACTION = "<?php echo $_SERVER['PHP_SELF'];?>" METHOD="POST">
<input type="text" name="theirName" value="" required="required">    ...
</form>




In standard PHP I get the POST value like this:


$name = $_POST['theirName'];

how I getting data values from form in Fat-Free framework?

lik this?

$name=$f3->get('POST.theirName');


I try like this in fat-free frame,but it doesn't  recevie any value.





Nuwanda

unread,
Sep 24, 2015, 10:15:51 PM9/24/15
to Fat-Free Framework
Set a url in your form action:

<form action="/process" method="post">

   
<input type="text" id="data" name="data">

   
<button type="submit">Submit</button>
   
</form>



Which points to a route you've defined which accepts the post method:

$f3->route('POST /process',
   
function($f3){

   
}
);



That processes your post data:

$f3->route('POST /process',
   
function($f3){

      echo $f3
->get('POST.data');

   
}
);



And turn on debugging so you see errors:

$f3->set('DEBUG',3);

Nuwanda

unread,
Sep 24, 2015, 10:23:27 PM9/24/15
to Fat-Free Framework
A major difference between CI and F3 is that CI relies almost exclusively on automatic routing based on the url. F3 requires explicit definition of all routes and the methods they will accept.

Read the routing section:

http://fatfreeframework.com/user-guide




On Friday, September 25, 2015 at 1:52:22 PM UTC+12, xiao liu wrote:

xiao liu

unread,
Sep 27, 2015, 8:56:11 PM9/27/15
to Nuwanda via Fat-Free Framework




--
You received this message because you are subscribed to a topic in the Google Groups "Fat-Free Framework" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/f3-framework/lA00_n_htQc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to f3-framework...@googlegroups.com.
To post to this group, send email to f3-fra...@googlegroups.com.
Visit this group at http://groups.google.com/group/f3-framework.
For more options, visit https://groups.google.com/d/optout.

Anatol Buchholz

unread,
Sep 28, 2015, 4:42:45 AM9/28/15
to Fat-Free Framework
maybe your route is /search and your form points to /serach
Reply all
Reply to author
Forward
0 new messages