Problem in fetching values passed thru form

Permalink
Hi guys,
I have a form in concrete/elements/files/one.php from where i m passing a value thru a hidden form to b fetched in a file in concrete/single_pages/two.php.
I have the single page using anchor tag as i need to open d single page from a popup n passed the form value along with the anchor tag in its onclick event like dis:

concrete/elements/files/one.php

dis is d form:
<form name="frm_ref" id="frm_ref" method="post">

<input type="text" id="p_cid" name="pagecid" value="hello">


here, the two.php is called & hidden form values passed:

<a id="add-new-album" id="add_new_album" class="add_new_album" href="<?php echo $this->url('/two')?>" onclick="document.frm_ref.submit(); return f

alse;">Add Your Album</a>



but, the i cudnt fetch the value in two.php, i m fetching like dis:

concrete/single_pages/two.php
$pcID = $_POST['pagecid']

I have also tried $_REQUEST for getting its value, but with no success
have i opened two.php with wrong url?? I mean, one.php is somewhere else n two.php is somewhere else.What have I done wrong?

Kindly suggest
Thnx.

 
joseajohnson replied on at Permalink Reply
joseajohnson
Looks like you're missing the controller responsible for handling actions on the part of your single page, as well as the action declaration within the form tag.

If your form handler is on
concrete/single_pages/two.php

then your controller should be at the following, I believe:
concrete/controllers/two.php

Alternatively:
concrete/single_pages/two/view.php

and
concrete/controllers/two/controller.php

If your form has the action specified,
<form action="processme"..

then your controller would need
class TwoController extends Controller {
// view and whatnot
    public function processme() {
        if ($this->isPost()) {
            $p_cid = 'Submitted: ' . $this->post('pagecid');             
            $this->set('p_cid_new', $p_cid);    
         }
    }
}

so your single page (view.php or two.php, depending on whether or not you've got them in a subdirectory) would then be capable of displaying the submitted values.
<html>
The value <?php echo $p_cid_new?>, has been added.
</html>

You might want to check

http://www.concrete5.org/documentation/developers/pages/single-page...

for a quick rundown of Single Pages, and hit the link at the bottom for a complete walk through.

btw, all d misspellings in dis post made it difficult to read; you may receive more responses in a shorter period otherwise: just a thought.

Good Luck!