本文整理汇总了PHP中form::post方法的典型用法代码示例。如果您正苦于以下问题:PHP form::post方法的具体用法?PHP form::post怎么用?PHP form::post使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类form
的用法示例。
在下文中一共展示了form::post方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editAction
public function editAction($id, $type = '')
{
$config = zotop::model('zotop.config');
$config->id = $id;
if (form::isPostBack()) {
$post = form::post();
$post['settings'] = json_encode($post['settings']);
$update = $config->update($post, $id);
if ($update) {
msg::success('保存成功,重新加载中,请稍后……', zotop::url('zotop/config/index', array('parentid' => $post['parentid'])));
}
msg::error(zotop::dump($post, true));
}
$field = $config->read();
$field['settings'] = (array) json_decode($field['settings']);
$type = empty($type) ? $field['type'] : $type;
$field['type'] = $type;
$page = new dialog();
$page->set('title', '编辑');
$page->set('body', array('style' => 'min-width:600px;'));
$page->set('field', $field);
$page->set('type', $type);
$page->set('types', $config->types());
$page->set('controls', $config->controls());
$page->set('attrs', $config->attrs($type));
$page->display();
}
示例2: actionEdit
public function actionEdit($id)
{
$blog = zotop::model('blog.blog');
$status = $blog->status();
$category = zotop::model('blog.category');
$categorys = $category->getAll();
if (form::isPostBack()) {
$post = form::post();
$blog->edit($post, $id);
if (!$blog->error()) {
msg::success('保存成功', form::referer());
}
msg::error($blog->msg());
}
//读取数据
$data = $blog->read($id);
$categoryid = $data['categoryid'];
//渲染页面
$page = new page();
$page->set('title', '编辑日志');
$page->set('navbar', $this->navbar($categoryid));
$page->set('globalid', $blog->globalid());
$page->set('data', $data);
$page->set('status', $status);
$page->set('categoryid', $categoryid);
$page->set('categorys', $categorys);
$page->display();
}
示例3: actionEdit
public function actionEdit($id, $type = '')
{
$config = zotop::model('system.config');
$config->id = $id;
if (form::isPostBack()) {
$post = form::post();
$post['settings'] = json_encode($post['settings']);
$update = $config->update($post, $id);
if ($update) {
$config->cache(true);
msg::success('保存成功,重新加载中,请稍后……', zotop::url('system/config/index/' . $post['parentid']));
}
msg::error($update);
}
$field = $config->read();
$field['settings'] = (array) json_decode($field['settings']);
//重新选择
if (!empty($type)) {
$field['type'] = $type;
} else {
$type = $field['type'];
}
$page = new dialog();
$page->set('title', '编辑');
$page->set('body', array('style' => 'min-width:600px;'));
$page->set('field', $field);
$page->set('type', $type);
$page->set('types', $config->getControlTypes());
$page->set('attrs', $config->getControlAttrs($type, $field));
$page->display();
}
示例4: run
public function run()
{
try {
$form = new form();
$form->post('new_email')->val('is_email', '', 'Please enter a valid email address');
$form->post('new_user')->val('minlength', 5, 'Username is too short')->val('maxlength', 15, 'now it\'s too long!');
$form->post('new_pass')->val('minlength', 7, 'password is too short');
$to_check = $form->fetch('new_pass');
$form->post('new_pass_check')->val('confirm', $to_check, 'passwords do not match bruvnaar');
$form->submit();
$data = $form->fetch();
$this->model->createUser($data);
} catch (Exception $e) {
session::set('error_message', $e->getMessage());
header('Location: ../register');
}
}
示例5: run
public function run()
{
try {
$form = new form();
$form->post('username')->val('asci_check', '', 'No strange characters mind..');
$form->post('password');
if (isset($_POST['remember'])) {
$form->post('remember');
}
$form->submit();
$data = $form->fetch();
//print_r($data);die;
$this->model->link($data);
} catch (Exception $e) {
$_SESSION = array();
$_SESSION['errors'] = $e->getMessage();
header('Location: ../login');
}
}
示例6: subVal
public function subVal()
{
try {
$form = new form();
$form->post('name')->val('minlength', 2)->val('maxlength', 20)->post('password')->val('minlength', 1)->val('maxlength', 20)->post2('password', 'passwordConfirm')->val('samepass', 'password', 'passwordConfirm');
$form->mit();
$data = $form->fetch();
$this->editSave($_SESSION['userId']);
} catch (Exception $e) {
$str = $form->mit2();
$this->view->ValError = $str;
$this->edit();
}
}
示例7: emailValidation
public function emailValidation()
{
try {
$form = new form();
$form->post('email')->val('minlength', 5)->val('emailExist');
$form->mit();
$data = $form->fetch();
return $data['email'];
// print_r($data);
// $this->view->render('signup/reset');
} catch (Exception $e) {
$str = $form->mit2();
$this->view->ValError = $str;
// $this->view->render('signup/reset');
}
}
示例8: array
function addNew_exec()
{
$response_array = array();
try {
$form = new form();
$form->post('comp_name')->val('Individual / Company Name', 'minlength')->post('comp_reg_no')->post('comp_address')->val('Address', 'minlength')->post('comp_postcode')->val('Poscode', 'minlength')->post('comp_state')->val('State', 'minlength')->post('state_other')->val('State', 'minlength')->post('comp_country')->val('Country', 'minlength')->post('comp_phone1')->val('Phone 1', 'minlength')->post('comp_phone2')->post('comp_fax')->post('website')->post('category')->val('Category', 'minlength')->post('tag')->val('Keyword Tag', 'minlength')->post('desc')->val('Description', 'minlength')->post('salutation')->val('Salutation', 'minlength')->post('p_fullname')->val('Fullname', 'minlength')->post('p_pos')->post('p_phone')->post('p_mobile')->val('Mobile No.', 'minlength')->post('p_gender')->val('Gender', 'minlength')->post('comp_email')->val('Email', 'minlength')->post('regdate');
$form->submit();
$data = $form->fetch();
$result = $this->model->addNew_exec($data);
$response_array['r'] = $result['r'];
$response_array['msg'] = $result['msg'];
} catch (Exception $e) {
$response_array['r'] = 'false';
$response_array['msg'] = $e->getMessage();
}
echo json_encode($response_array);
}
示例9: forgotPass
function forgotPass()
{
$response_array = array();
try {
$form = new form();
$form->post('email')->val('Email', 'email');
$form->submit();
$data = $form->fetch();
$result = $this->model->forgotPass_exec($data);
$response_array['r'] = $result['r'];
$response_array['msg'] = $result['msg'];
} catch (Exception $e) {
$response_array['r'] = 'false';
$response_array['msg'] = $e->getMessage();
}
echo json_encode($response_array);
}
示例10: update
public function update()
{
try {
$form = new form();
$form->post('email')->val('minlength', 5)->val('subExist')->post('notify');
$form->mit();
$data = $form->fetch();
$this->model->updateEmail($data);
$this->view->ValError2 = 'Email options successfully updated!';
header('location: ' . URL . 'email?email=' . $data['email']);
// $this->view->render('email/index');
} catch (Exception $e) {
$str = $form->mit2();
$this->view->ValError = $str;
$this->view->render('email/index');
}
}
示例11: actionEdit
public function actionEdit($id)
{
$category = zotop::model('blog.category');
if (form::isPostBack()) {
$post = form::post();
$category->update($post, $id);
if (!$category->error()) {
msg::success('保存成功', zotop::url('blog/category/index'));
}
msg::error($category->msg());
}
$category->id = $id;
$data = $category->read();
$page = new dialog();
$page->set('title', '编辑分类');
$page->set('data', $data);
$page->display();
}
示例12: actionTheme
public function actionTheme()
{
$config = zotop::model('system.config');
if (form::isPostBack()) {
$post = form::post();
$config->save($post);
if ($config->error()) {
msg::error($config->msg());
}
msg::success('保存成功');
}
$theme = $config->fields('system.theme');
$page = new page();
$page->set('title', zotop::t('系统设置'));
$page->set('navbar', $this->navbar());
$page->set('theme', $theme);
$page->display();
}
示例13: actionUpload
public function actionUpload()
{
$config = zotop::model('zotop.config');
if (form::isPostBack()) {
$post = form::post();
$save = $config->save($post);
if ($save) {
msg::success('保存成功,重新加载中,请稍后……');
}
msg::error($save);
}
$fields = $config->fields('upload');
$page = new page();
$page->set('title', '上传设置');
$page->set('navbar', $this->navbar());
$page->set('fields', $fields);
$page->display();
}
示例14: changeInfoAction
public function changeInfoAction()
{
$user = zotop::model('zotop.user');
$user->id = (int) zotop::user('id');
if (form::isPostBack()) {
$post = form::post();
$update = $user->update($post, $user->id);
if ($update) {
msg::success('资料设置成功,正在刷新页面,请稍后……', url::current());
}
msg::error();
}
$data = $user->read();
$page = new page();
$page->title = '修改我的基本信息';
$page->set('navbar', $this->navbar());
$page->set('data', $data);
$page->display();
}
示例15: addAction
public function addAction()
{
$user = zotop::model('zotop.user');
$usergroup = zotop::model('zotop.usergroup');
if (form::isPostBack()) {
$post = form::post();
if (empty($post['id'])) {
$post['id'] = $user->max('id') + 1;
}
if (empty($post['username'])) {
msg::error('帐户名称不能为空');
}
if (empty($post['password'])) {
msg::error('帐户密码不能为空');
}
if ($post['password'] != $_POST['_password']) {
msg::error('两次输入的密码不一致');
}
if ($user->isExist('username', $post['username'])) {
msg::error('帐户名称<b>' . $post['username'] . '</b>已经存在');
}
if ($user->isExist('email', $post['email'])) {
msg::error('电子邮件<b>' . $post['email'] . '</b>已经存在');
}
$post['password'] = $user->password($post['password']);
$post['loginnum'] = $post['loginnum'] || 0;
$post['createtime'] = $post['createtime'] || TIME;
$post['modelid'] = 'system';
$insert = $user->insert($post);
if ($insert) {
msg::success('保存成功,正在返回列表页面,请稍后……', zotop::url('zotop/user'));
}
}
//获取用户组
$usergroups = $usergroup->getIndex('system');
$page = new page();
$page->set('title', '添加新用户');
$page->set('position', $position);
$page->set('navbar', $this->navbar());
$page->set('data', $data);
$page->set('usergroups', $usergroups);
$page->display();
}