简体   繁体   中英

Pass variable to helper.php

Having a bit of a mind blank at the moment. I have an input field and trying to pass the value of the input when the form is submitted, to a function in the helper.php

default.php

<input name="value" type="text" />
<input name="delete" type="submit" value="submit" />

mod_xxxxxx.php

if(isset($post['delete'])) {
    $delete = $post['value'];
    modXxxxxxxHelper::delete($delete);
}

helper.php

function delete($delete) {
    $value = //get the variable 
}

How can I can the value of the input field which will then define $value ?

Please note that I am using Joomla 2.5 coding standards and therefore $post has already been defined and works correctly

Since you're passing $post['value'] to the method then you can just access that variable using $delete

function delete($delete) {
    // $delete would have the value of $post['value']
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM