本文整理汇总了PHP中form_error函数的典型用法代码示例。如果您正苦于以下问题:PHP form_error函数的具体用法?PHP form_error怎么用?PHP form_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了form_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: block_content
public function block_content($context, array $blocks = array())
{
// line 4
echo "<h4>Edit Kelas Aktif</h4>\n";
// line 5
echo get_flashdata("class");
echo "\n\n";
// line 7
echo form_open("siswa/moved_class/" . (isset($context["status_id"]) ? $context["status_id"] : null) . "/" . (isset($context["siswa_id"]) ? $context["siswa_id"] : null), array("class" => "form-horizontal row-fluid"));
echo "\n<table class=\"table table-striped\">\n <tr>\n <td>\n <select class=\"span2\" name=\"kelas_id\">\n <option value=\"\">--pilih--</option>\n ";
// line 13
$context['_parent'] = (array) $context;
$context['_seq'] = twig_ensure_traversable(isset($context["kelas"]) ? $context["kelas"] : null);
foreach ($context['_seq'] as $context["_key"] => $context["k"]) {
// line 14
echo " <option value=\"";
echo twig_escape_filter($this->env, $this->getAttribute(isset($context["k"]) ? $context["k"] : null, "id"), "html", null, true);
echo "\" ";
echo $this->getAttribute(isset($context["k"]) ? $context["k"] : null, "id") == $this->getAttribute(isset($context["get_aktif"]) ? $context["get_aktif"] : null, "kelas_id") ? "selected" : "";
echo ">";
echo twig_escape_filter($this->env, $this->getAttribute(isset($context["k"]) ? $context["k"] : null, "nama"), "html", null, true);
echo "</option>\n ";
}
$_parent = $context['_parent'];
unset($context['_seq'], $context['_iterated'], $context['_key'], $context['k'], $context['_parent'], $context['loop']);
$context = array_intersect_key($context, $_parent) + $_parent;
// line 16
echo " </select>\n <br>";
// line 17
echo form_error("kelas_id");
echo "\n </td>\n <td>\n <button type=\"submit\" class=\"btn btn-primary\">Update</button>\n </td>\n </tr>\n</table>\n";
// line 24
echo form_close();
echo "\n";
}
开发者ID:Raniratna,项目名称:new_elearning,代码行数:35,代码来源:669a4f6e8c7dc02a4e11f673e2a6c35fc22a4b99b59d453296af0e9866a0.php
示例2: writeProjectRow
function writeProjectRow($idx, $project)
{
//---------------------------------------------------------------------
//
//---------------------------------------------------------------------
if (is_numeric($project->lAssignedMin)) {
$strValue = strDurationViaMinutes($project->lAssignedMin);
} else {
$strValue = $project->lAssignedMin;
}
echoT('
<tr>
<td class="enpViewLabel" style="padding-top: 8px;">' . htmlspecialchars($project->strGroupName) . ':
</td>
<td class="enpView" style="vertical-align: top;">
<input type="text" name="txtPMin' . $idx . '"
size="5"
maxlength="8"
style="text-align: right;" onFocus="txtPMin' . $idx . '.style.background=\'#fff\';"
id="addEditEntry"
value="' . $strValue . '">
</td>
<td style="vertical-align: top; padding-top: 6pt;">
hh:mm
</td>
<td style="width: 45pt; text-align: right;vertical-align: top; padding-top: 6pt;">
Notes:
</td>
<td style="text-align: top;">
<textarea name="txtNotes' . $idx . '" rows="2" cols="30">' . $project->notes . '</textarea>' . form_error('txtPMin' . $idx) . '
</td>
</tr>');
}
示例3: process_form
public function process_form()
{
$this->load->library('form_validation');
$this->form_validation->set_rules("name", "name", "required|trim|xss_clean");
$this->form_validation->set_rules("comment", "comment", "xss_clean");
// if validation errors exist, send user back to form else send user to result page.
if ($this->form_validation->run() === FALSE) {
$this->session->set_userdata('error', form_error('name'));
redirect('/');
} else {
$this->session->unset_userdata('error');
$this->session->set_userdata('name', $this->input->post('name', true));
$this->session->set_userdata('location', $this->input->post('location'));
$this->session->set_userdata('language', $this->input->post('language'));
$this->session->set_userdata('comment', $this->input->post('comment', true));
// set counter to display number of times current user submits the form
if ($this->session->userdata('counter')) {
$counter = $this->session->userdata('counter');
$this->session->set_userdata('counter', $counter + 1);
} else {
$this->session->set_userdata('counter', 1);
}
redirect('result');
}
}
示例4: validateSettings
/**
* Validate the settings form.
*/
public function validateSettings(&$element, &$form_state)
{
$schema = drupal_get_schema('membership_entity');
if ($element['length']['#value'] > $schema['fields']['member_id']['length']) {
form_error($element['length'], t('Member ID length cannot exceed %max.', array('%max' => $schema['fields']['member_id']['length'])));
}
}
示例5: login_proses
function login_proses()
{
$data['pesan'] = '';
$data['username'] = $this->input->post('username');
$data['password'] = $this->input->post('password');
$this->form_validation->set_rules("username", 'Username', 'trim|required|xss_clean');
$this->form_validation->set_rules("password", 'Password', 'trim|required|xss_clean');
# message rules
$this->form_validation->set_message('required', 'Field %s harus diisi.');
if ($this->form_validation->run() == FALSE) {
// jika tidak valid
$data['pesan'] .= trim(form_error('username', ' ', ' ')) == '' ? '' : form_error('username', ' ', '<br>');
$data['pesan'] .= trim(form_error('password', ' ', ' ')) == '' ? '' : form_error('password', ' ', '<br>');
$this->load->view('auth/form_login', $data);
} else {
$result = $this->mdl_auth->ceklogin($data);
if ($result->num_rows() > 0) {
$this->session->set_userdata('user_id', $result->row()->user_id);
$this->session->set_userdata('user_name', $result->row()->user_name);
$this->session->set_userdata('full_name', $result->row()->full_name);
$this->session->set_userdata('user_level_id', $result->row()->user_level_id);
$this->session->set_userdata('kd_fakultas', $result->row()->kd_fakultas);
$this->session->set_userdata('kd_prodi', $result->row()->kd_prodi);
$this->session->set_userdata('login', TRUE);
redirect('main');
} else {
$data['pesan'] .= '<b>Login Gagal<b> <br> masukan username dan password dengan benar.';
$this->load->view('auth/form_login', $data);
}
}
}
示例6: submitform1
function submitform1()
{
$this->form_validation->set_rules('input-txtfield', 'Textfield', 'trim|required|xss_clean|max_length[100]');
$this->form_validation->set_rules('input-textarea', 'Textarea', 'trim|required|xss_clean|max_length[1024]');
$this->form_validation->set_rules('input-radio', 'Radio', 'trim|required|xss_clean');
$this->form_validation->set_rules('input-checkbox[]', 'Checkbox', 'trim');
$successurl = base_url('welcome/form1');
if ($this->form_validation->run() == false) {
$res['error'] = true;
$res['display_errors']['input-txtfield-error'] = form_error('input-txtfield');
$res['display_errors']['input-textarea-error'] = form_error('input-textarea');
$res['display_errors']['input-radio-error'] = form_error('input-radio');
$res['display_errors']['input-checkbox-error'] = form_error('input-checkbox');
} else {
$res['error'] = false;
$res['s_title'] = "STitle";
$res['s_text'] = "Form submitted successfully";
$res['eval_script'] = "load_view('#my-content', 'content1', '" . $successurl . "');";
}
if ($this->input->is_ajax_request()) {
echo json_encode($res);
} else {
if ($res['error'] == true) {
$this->res = $res;
$this->view_maintenance_head($society_id, $head_id);
} else {
$this->session->set_flashdata('success_message', $res['s_text']);
redirect($successurl);
}
}
}
示例7: signup
/**
* Signup
* Presents user with a signup form.
*/
public function signup()
{
$this->load->helper('form');
$this->layouts->set_title('Sign Up');
$data['signup_form_first_name'] = $this->security->xss_clean($this->input->post('signup_form_first_name'));
$data['signup_form_last_name'] = $this->security->xss_clean($this->input->post('signup_form_last_name'));
$data['signup_form_email'] = $this->security->xss_clean($this->input->post('signup_form_email'));
$data['signup_form_username'] = $this->security->xss_clean($this->input->post('signup_form_username'));
$data['signup_form_lost_password_question_1'] = $this->security->xss_clean($this->input->post('signup_form_lost_password_question_1'));
$data['signup_form_lost_password_question_2'] = $this->security->xss_clean($this->input->post('signup_form_lost_password_question_2'));
$data['signup_form_lost_password_question_3'] = $this->security->xss_clean($this->input->post('signup_form_lost_password_question_3'));
if ($this->input->post('ajax') && !$this->input->post('test')) {
$this->layouts->view('accounts/signup', $data, 'json');
} elseif ($this->input->post('ajax') && $this->input->post('test')) {
$data['changes'] = [];
if (form_error($this->input->post('test_field'))) {
$data['changes'][] = ['target' => '#' . $this->input->post('test_field') . '_error', 'content' => form_error($this->input->post('test_field'))];
} else {
$data['changes'][] = ['target' => '#' . $this->input->post('test_field') . '_error', 'content' => ''];
}
$data['changes'][] = ['target' => '#signup_form_bucket_csrf_token', 'value' => $this->security->get_csrf_hash()];
$this->layouts->view(null, $data, 'json');
} else {
$this->layouts->view('accounts/signup', $data);
}
}
示例8: save
public function save()
{
$this->load->library('form_validation');
$frm = $this->form_validation;
$frm->set_rules('name', 'Name', 'trim|required');
$frm->set_rules('database', 'Database', 'trim|required');
$frm->set_message('required', 'กรุณากรอก %s');
if ($frm->run() == FALSE) {
$message = '';
$message .= form_error('name');
$message .= form_error('database');
$result = array('result' => FALSE, 'message' => $message);
} else {
$post = $this->input->post(NULL, TRUE);
// returns all POST/GET items with XSS filter
$data = array('id' => $post['id'], 'name' => $post['name'], 'database' => $post['database'], 'remark' => $post['remark']);
$this->model->id = $post['id'];
if ($this->model->save($data)) {
$result = array('result' => true);
} else {
$result = array('result' => false, 'message' => $this->db->error());
}
}
echo json_encode($result);
}
示例9: proses
public function proses()
{
$this->load->library('form_validation');
$this->form_validation->set_rules('username', 'Username', 'trim|required|alpha_numeric|min_length[3]');
$this->form_validation->set_rules('password', 'Password', 'trim|required');
if ($this->form_validation->run() == FALSE) {
if (validation_errors('username') != NULL) {
$view['error_username'] = strip_tags(form_error('username'));
}
if (validation_errors('password') != NULL) {
$view['error_password'] = strip_tags(form_error('password'));
}
} else {
$this->load->model('login_model');
$username = $this->input->post('username');
$password = $this->input->post('password');
$doLogin = $this->login_model->doLogin($username, $password);
if ($doLogin) {
$this->load->library('sess');
$this->sess->sess_reg($doLogin);
$view['success'] = "Success Login";
} else {
$view['error_failed'] = "username or password WRONG!";
}
}
header('content-type:application/json');
echo json_encode($view);
exit;
}
示例10: _nuevoProveedor_Cliente
function _nuevoProveedor_Cliente($tipo)
{
$nombre = $_POST["nombre"];
$rif = $_POST["rif"];
$msj_nombre = "";
$msj_rif = "";
$error = 0;
$this->load->library("form_validation");
$this->form_validation->set_rules("nombre", "Nombre", "required");
$this->form_validation->set_rules("rif", "RIF", "required|is_rif");
if ($this->form_validation->run()) {
try {
/*if($tipo=="Proveedor"){
$proveedorCliente=new Entities\Proveedor;
}else{
$proveedorCliente=new Entities\Cliente;
}*/
$proveedorCliente = new Entities\ProveedorCliente();
$proveedorCliente->setNombre($nombre);
$rif = preg_replace("/^([J|V|G])\\-?(\\d{8})\\-?(\\d)\$/", "\$1-\$2-\$3", $rif);
$proveedorCliente->setRif($rif);
$proveedorCliente->setTipo($tipo);
guardar($proveedorCliente, TRUE);
} catch (Exception $e) {
$error = 1;
$nombre = "";
$rif = "";
}
} else {
$msj_nombre = form_error("nombre");
$msj_rif = form_error("rif");
$error = 1;
}
return json_encode(array("nombre" => $nombre, "rif" => $rif, "error" => $error, "msj_nombre" => $msj_nombre, "msj_rif" => $msj_rif));
}
示例11: index
public function index()
{
$this->load->library('form_validation');
$this->form_validation->set_rules('user_full_name', 'Name', 'required|min_length[5]');
$this->form_validation->set_rules('user_name', 'username', 'required|min_length[5]|is_unique[users.username]');
$this->form_validation->set_rules('email_address', 'Email', 'required|is_unique[users.email]|valid_email');
$this->form_validation->set_rules('password', 'Password ', 'required|min_length[5]|matches[con_password]');
$this->form_validation->set_rules('con_password', 'Password', 'required|min_length[5]');
$this->form_validation->set_message('required', 'required');
$this->form_validation->set_message('min_length', 'lenght');
$this->form_validation->set_message('is_unique', 'Allready exist');
$this->form_validation->set_message('valid_email', 'Invalid Email');
$this->form_validation->set_message('matches', 'password not match');
if ($this->form_validation->run() == true) {
$this->user_model->add_user();
$this->load->library('email');
$this->email->from('pass_support@privilegedpk.com', 'Komail');
$this->email->to($this->input->post('email_address'));
$this->email->subject('Email Verification');
$this->email->message('http://privilegedpk.com/prev/index.php/signup/verify?email=' . $this->input->post('email_address'));
$this->email->send();
//echo $this->email->print_debugger();
redirect('main', 'refresh');
} else {
redirect($this->input->post('current') . 'un=' . form_error('user_name') . '&&nam=' . form_error('user_full_name') . '&&email=' . form_error('email_address') . '&&pass=' . form_error('password') . '&&pass1=' . form_error('con_password'));
}
}
示例12: addsupport
public function addsupport()
{
$this->form_validation->set_rules('fname', 'FirstName', 'trim|required|max_length[300]');
$this->form_validation->set_rules('lname', 'LastName', 'trim|required|max_length[300]');
$this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');
$this->form_validation->set_rules('phone', 'Phone', 'trim|is_natural|min_length[10]|max_length[11]');
$this->form_validation->set_rules('cmt', 'Address', 'trim|required|max_length[300]');
$this->form_validation->set_rules('zip', 'Zipcode', 'trim|is_natural');
$this->form_validation->set_rules('recaptcha', 'ReCaptcha', 'callback_check_recaptcha');
if (!$this->form_validation->run()) {
$result = array('ajax' => 1, 'error_fname' => form_error('fname'), 'error_lname' => form_error('lname'), 'error_email' => form_error('email'), 'error_phone' => form_error('phone'), 'error_cmt' => form_error('cmt'), 'error_zip' => form_error('zip'), 'error_recaptcha' => form_error('recaptcha'), 'capt' => $this->create_capt());
echo json_encode($result);
} else {
$this->email->from('nhokgalai@gmail.com', 'Email Support');
$this->email->to($this->input->post('email'));
$this->email->cc('nhoxgalai@gmail.com');
$this->email->subject($this->input->post('fname') . ' Need to support!');
$this->email->message('First Name: ' . $this->input->post('fname') . '<br>' . 'Last Name: ' . $this->input->post('lname') . '<br>' . 'Phone: ' . $this->input->post('phone') . '<br>' . 'Address: ' . $this->input->post('address') . '<br>' . 'City: ' . $this->input->post('city') . '<br>' . 'State/Province: ' . $this->input->post('s_p') . '<br>' . 'Zip/Postal Code: ' . $this->input->post('zip') . '<br>' . 'Industry: ' . $this->input->post('indus') . '<br>' . 'Message:<br>' . $this->input->post('cmt'));
if ($this->email->send()) {
$result['result'] = "\n\t\t\t\t<div class='alert alert-success' role='alert'>\n\t\t\t\t\t<strong>Well done!</strong>Thanks for your mail. We will contact you as soon as posible!<br>\n\t\t\t\t \t<a href='" . base_url() . "' class='alert-link'>Back to Home Page!</a>\n\t\t\t\t</div>\n\t\t\t\t";
$result['kt'] = 0;
echo json_encode($result);
} else {
$result['result'] = "\n\t\t\t\t<div class='alert alert-warning' role='alert'>\n\t\t\t\t\t<strong>Warning!</strong>There are Errors! Please try againt!<br>\n\t\t\t\t \t<a href='" . base_url() . "' class='alert-link'>Back to Home Page!</a>\n\t\t\t\t</div>\n\t\t\t\t";
$result['kt'] = 1;
echo json_encode($result);
}
}
}
示例13: add_new_category
function add_new_category()
{
// validate form
$this->load->library('form_validation');
$this->form_validation->set_rules('categoryName', 'categoryName', 'trim|required|xss_clean');
// if form is invalid
if ($this->form_validation->run() == FALSE) {
if (form_error('categoryName')) {
$this->session->set_flashdata('msg', 'กรุณาใส่ชื่อหมวดหมู่');
redirect('admin/add_category');
return;
}
}
$name = set_value('categoryName');
//add category
$arr = array('category_name' => $name);
$res = $this->Category->add_category($arr);
// if can't add to db
if ($res == FALSE) {
$this->session->set_flashdata('msg', 'ไม่สามารถเพิ่มหมวดหมู่ได้');
redirect('admin/add_category');
return;
}
redirect('admin/category');
}
示例14: block_content
public function block_content($context, array $blocks = array())
{
// line 4
echo "<div class=\"module\">\n <div class=\"module-head\">\n <h3>";
// line 6
echo isset($context["module_title"]) ? $context["module_title"] : null;
echo "</h3>\n </div>\n <div class=\"module-body\">\n ";
// line 9
echo get_flashdata("mapel");
echo "\n\n ";
// line 11
echo form_open("admin/mapel/add", array("class" => "form-horizontal row-fluid"));
echo "\n <div class=\"control-group\">\n <label class=\"control-label\">Nama <span class=\"text-error\">*</span></label>\n <div class=\"controls\">\n <input type=\"text\" name=\"nama\" class=\"span8\" value=\"";
// line 15
echo twig_escape_filter($this->env, set_value("nama"), "html", null, true);
echo "\">\n <br>";
// line 16
echo form_error("nama");
echo "\n </div>\n </div>\n <div class=\"control-group\">\n <label class=\"control-label\">Deskripsi</label>\n <div class=\"controls\">\n <textarea name=\"info\" class=\"span12\" rows=\"5\">";
// line 22
echo set_value("info");
echo "</textarea>\n </div>\n </div>\n <div class=\"control-group\">\n <div class=\"controls\">\n <button type=\"submit\" class=\"btn btn-primary\">Simpan</button>\n <a href=\"";
// line 28
echo twig_escape_filter($this->env, site_url("admin/mapel"), "html", null, true);
echo "\" class=\"btn\">Batal</a>\n </div>\n </div>\n ";
// line 31
echo form_close();
echo "\n\n </div>\n</div>\n";
}
开发者ID:Raniratna,项目名称:new_elearning,代码行数:29,代码来源:e77bfcb44e01e83cd758d3bf076b694ee0546ba32e73d1a1f758f2d79475.php
示例15: block_content
public function block_content($context, array $blocks = array())
{
// line 4
echo "<div class=\"module\">\n <div class=\"module-head\">\n <h3>";
// line 6
echo isset($context["module_title"]) ? $context["module_title"] : null;
echo "</h3>\n </div>\n <div class=\"module-body\">\n ";
// line 9
echo get_flashdata("kelas");
echo "\n\n <div class=\"panel panel-default\">\n <div class=\"panel-heading\">\n Tambah Kelas\n </div>\n <div class=\"panel-body\">\n ";
// line 16
echo form_open("admin/kelas", array("class" => "form-horizontal row-fluid"));
echo "\n <div class=\"control-group\">\n <label class=\"control-label\">Nama Kelas <span class=\"text-error\">*</span></label>\n <div class=\"controls\">\n <input type=\"text\" name=\"nama\" class=\"span5\" placeholder=\"Nama Kelas\" value=\"";
// line 20
echo twig_escape_filter($this->env, set_value("nama"), "html", null, true);
echo "\">\n <button type=\"submit\" class=\"btn btn-primary\">Simpan</button>\n ";
// line 22
echo form_error("nama");
echo "\n </div>\n </div>\n ";
// line 25
echo form_close();
echo "\n </div>\n </div>\n\n <p><b>Note:</b> Kelas tidak dapat di hapus namun dapat di ubah menjadi tidak aktif</p>\n\n ";
// line 31
echo isset($context["kelas_hirarki"]) ? $context["kelas_hirarki"] : null;
echo "\n\n <br>\n <div id=\"response_update\"></div>\n <button class=\"btn btn-primary\" id=\"update-hirarki\">Update Hirarki</button>\n </div>\n</div>\n";
}
开发者ID:Raniratna,项目名称:new_elearning,代码行数:26,代码来源:e21e79c49e313b4c30919792b145d76ccb359710f0fc8fdd1add2842d09e.php