Jump to content

lost my code... input post value


bwakad
 Share

Recommended Posts

Due to an error on my side, I deleted a file before backing up.

So, I had to make my page from scratch... but using the code below, I cant access the $input->value to check for errors.

Tried $input->post / $input->get. Either with "contract" and ->contract.

Must be forgetting something... It's driving me nutz!

-- EDIT --

Forgot I first have to submit before getting value back. lol. really stupido! Answer in API:

if ($input->post->submit_details){
    $value = $input->post->contract;   // access as object property
    echo $value;
    $value = $input->post['contract']; // access as array index
    echo $value;
    $value = $input->post('contract'); // access as function
    echo $value;
}
$form =    "<div class='row'><div class='medium-8 columns'>
        <form action='./' id='details' method='post'>
        <fieldset><legend>Details of {$user->name}</legend>
        <div class='row collapse'><label for='contract'>Contract <small>Required</small>
        <select id='contract' name='contract' ><option value=''>Please select</option>";

            foreach ($pages->get("/contract/")->children() as $child) {
                if (!empty($member_page->get('contract')))
                    $selected = $child->name == $member_page->get('contract')->name ? " selected='selected' " : '';

$form .=     "<option$selected value='{$child->name}'>{$child->title}</option>";

            }

$form .=    "</select></label></div>
            </fieldset><button class='button tiny' type='submit' name='submit_details' value='submit_details' id='submit'>Submit</button></form></div></div>";
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...