Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-01-2008, 12:09 PM
Mischa's Avatar
Junior Member
 
Join Date: Apr 2008
Posts: 5
Default Problem with getPost()

Hello,
i have little problem. When i use and little edit "get started" script on my Web ... and use <form> with metod POST ... after send is IsPost() as true, but $_POST vars dont exist ... (empty array).
With GET (getQuery or getParam) params istn problem.

when i try <form action"some_URL/?test=ABC" metod POST> and send it ... $_GET -> array(['test'] = "ABC")
$_POST -> array ()

here is source code Index of /code, and compressed whole aplication .... : http://temp.ujak.cz/code/res.txt its result after i SUBMIT form

SYSTEM:
Version ZF: 1.5.1
PHP: 5xx
Apache 2.0.x
Server: Linux Fedora Core 5
Zend Optymalizer: Yes


-------------------------------------------------------------------
I view :
<form action="<?php echo $this->baseUrl ?>/whitelist/del/" method="POST">
<p>Opravdu smazat <?= $this->whitelist[0]["sender"]?>?</p>
<div>
<input type="hidden" name="id" value="<?php echo $this->whitelist[0]["id"]; ?>">
<input type="submit" name="del" value="Ano">
<input type="submit" name="del" value="Ne">
</div>
</form>


------------------------------------------------------------------------
in controllers:
if ($this->_request->isPost()) {

********* HERE IT IS OK AFTER SUBMIT ...

Zend_Loader::lo*adClass(‚Zend_Fil*ter_Alpha‘);
$filter = new Zend_Filter_Al*pha();
$id = (int)$this->_request->getPost(‚id‘);
$del = $filter->filter($this->_request->getPost(‚del‘));
if ($del == ‚Ano‘ && $id > 0) {

$db->query(„DELETE FROM whitelist WHERE id = ?“, $_GET[„id“]);
$this->_redirect(‚/whi*telist‘);
return;

} else if ($del == ‚Ne‘) {
$this->_redirect(‚/whi*telist‘);
return;
}

} else {
$id = (int)$this->_request->getQuery(‚id‘);

if ($id > 0) {
$dotaz = $db->query(„SELECT * FROM whitelist WHERE id=?“, $id);
$this->view->whitelist = $dotaz->fetchAll();
}
}
--------------------------------------------------------

sorry, my english is not good

Thanks
Mischa

Last edited by Mischa : 04-04-2008 at 03:52 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-01-2008, 02:08 PM
Ewok's Avatar
Junior Member
 
Join Date: Mar 2008
Location: Colorado SPrings
Posts: 16
Send a message via MSN to Ewok Send a message via Yahoo to Ewok
Default

Try
$this->_request->getParam("id",null);

This should get either GET or POST variable called id, and if it doesn't exist return null.
__________________
Give all victory and gain to others
Take all defeat and loss upon yourself
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-01-2008, 02:25 PM
Junior Member
 
Join Date: Mar 2008
Posts: 8
Default

Hello,
I'm facing the same problem, right now. I have this form declaration:

<form name="loginForm" method="post" id="loginForm" action="login/authenticate">

and in my index action for index controller, if user is not authenticated is redirected to login page wich is showing up well, but when I submit the form, in the authenticateAction i'm not able to get the post parameter, this is the code of the action (I've already try the above suggestion) but the same, not autheticated because I get redirected to the same page:

public function authenticateAction()
{
include_once MODELS_HOME.'Factory.php';
$auth = Factory::newInstance(AUTH);
$result = $auth->authenticate(
$this->getRequest()->getPost('username'),
$this->getRequest()->getPost('password')
);

if($result->isValid())
$this->_forward('index', 'index');
else
{
$error = '';
foreach ($result->getMessages() as $message)
{
$error .= $message."\n";
}
$this->_setParam('error', $error);
$this->_forward('login','login');
}
}

Any idea on what's going on,
Thank in advance.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-01-2008, 03:27 PM
Mischa's Avatar
Junior Member
 
Join Date: Apr 2008
Posts: 5
Default

Quote:
Originally Posted by Ewok View Post
Try
$this->_request->getParam("id",null);

This should get either GET or POST variable called id, and if it doesn't exist return null.
i try, but its the same
getPost, getParam, $_POST .... cannot get parametrs

if set form metod to GET, i get all parametrs from form.

when i write "clasic" php file (withouth ZF) in the same PUBLIC directory ... it go perfectly

Where is error ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-02-2008, 03:14 PM
Mischa's Avatar
Junior Member
 
Join Date: Apr 2008
Posts: 5
Default ...

Nobody dont know what it is ?
here is source code, and compressed whole aplication .... : Index of /code

there is http://temp.ujak.cz/code/res.txt its result after i SUBMIT form

System : Linux Fedora Core 5
PHP: 5
ZF: 1.5.1

Thanks
Mischa
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-08-2008, 06:16 AM
Mischa's Avatar
Junior Member
 
Join Date: Apr 2008
Posts: 5
Default :)

I know where is problem ... in SSL... because i have the pages under HTTPS with certificate. In normal non-SSL (port 80) it run ok ...

but how setup it for SSL ?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 12:34 PM.