Hi I'm making a form with a textarea using TinyMCE and when i press the submit button to send it to php DB, the button does nothing. I've put the textarea in commentary to see if it was the problem and it work so i've deduced that it was the problem.
There is my form code :
<div class="col-sm-12">
<form id="RedactionForm" action="redaction_post.php" method="post">
<?php
// Connexion à la base de données
try
{
$bdd = new PDO('mysql:host=localhost;dbname=utilisateur;charset=utf8', 'root', '', array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
}
catch(Exception $e)
{
die('Erreur : '.$e->getMessage());
}
date_default_timezone_set('Europe/Paris');
$date_creation = gmdate('Y-m-d h:i:s');
?>
<div class="col-sm-6 form-group">
<label for="titre" class="control-label" id="label-redac">Titre</label>
<input type="text" class="form-control" name ="titre" id="titre" placeholder="Le titre" data-title="Le titre est obligatoire" required="" data-regex="^[a-zA-Z]{1,150}$">
</div>
<div class="col-sm-6 form-group">
<label for="description" class="control-label" id="label-redac">Descritpion</label>
<input type="text" class="form-control" name ="description" id="description" placeholder="Une brève description de l'article" data-title="La description est obligatoire" required="" data-regex="^[a-zA-Z]{1,255}$">
</div>
<div class="col-sm-12 form-group">
<label for="contenu" class="control-label" id="label-redac2">Article</label>
<textarea class="form-control" name="contenu" id="contenu" placeholder="Rédigez l'article ici" data-title="Le contenu de l'article est obligatoire" required=""></textarea>
</div>
<input type='hidden' name='date_creation' id="date_creation" value="<?php echo "$date_creation";?>" />
<div class="alert alert-danger">
Error!
</div>
<div class="alert alert-sucess">
Sent!
</div>
<div class="form-group">
<input type="submit" value="Envoyer l'article" class="btn-primary btn-sm"/>
<!--<button type="submit" class="btn-primary btn-sm">Envoyer l'article</button>-->
<a class="btn-primary btn-sm" href="./index.php"><span class="glyphicon glyphicon-chevron-left"></span> Retour à la liste des articles</a>
</div>
</form>
</div>
dont use "required" in tag <textarea>
change sintaks
<textarea class="form-control" name="contenu" id="contenu" placeholder="Rédigez l'article ici" data-title="Le contenu de l'article est obligatoire" required=""></textarea>
to
<textarea class="form-control" name="contenu" id="contenu" placeholder="Rédigez l'article ici" data-title="Le contenu de l'article est obligatoire"></textarea>
maybe help you..
Related
I'm currently in an intership for a restaurant. I'm coding a website for them and I'm starting the CRUD on it.
The problem is that no data is passed to the controller, and so it doesn't update the drink.
Hope someone can help me.
I use a form to update a drink, here it is.
<div class="col-lg-6 order-lg-2">
<div class="p-5">
<p>Veuillez renseigner tous les champs !</p>
<p>Si un champ ne change pas, copier-coller ce champ depuis le tableau juste au-dessus.</p>
<form action="<?php base_url().'index.php/boissons/resp_modif_boisson/'.$son['id_boisson'] ?>" method="post">
<div class="form-group">
<label for="nom">Nom :</label>
<input type="text" class="form-control" id="nom" name="nom" maxlength="60" required>
</div>
<div class="form-group">
<label for="desc">Descriptif :</label>
<input type="text" class="form-control" id="desc" name="desc" maxlength="500" required>
</div>
<div class="form-group">
<label for="prix">Prix :</label>
<details>Si prix décimal, utilisez le "." ! (exemple : 1.99)</details>
<br>
<input type="number" class="form-control" id="prix" name="prix" min="0" step="0.01" value="0.00" required>
</div>
<button type="submit" class="btn btn-warning">Modifier</button>
</form>
</div>
</div>
And here is the controller.
public function resp_modif_boisson($num){
$this->load->helper('form');
$this->load->library('form_validation');
if($this->session->statut=="R"){
$this->form_validation->set_rules('nom', 'nom', 'required');
$this->form_validation->set_rules('desc', 'desc', 'required');
$this->form_validation->set_rules('prix', 'prix', 'required');
$nom = htmlspecialchars(addslashes($this->input->post('nom')));
$desc = htmlspecialchars(addslashes($this->input->post('desc')));
$prix = htmlspecialchars(addslashes($this->input->post('prix')));
var_dump($nom);
var_dump($desc);
var_dump($prix);
echo "test";
if ($this->form_validation->run() == FALSE){
$data['boi'] = $this->db_model->get_boisson($num);
echo "false";
$this->load->view('templates/haut_administrateur.php');
$this->load->view('resp_modif_boisson',$data);
$this->load->view('templates/bas');
}else{
$this->db_model->modif_boisson($num, $nom, $desc, $prix);
$data['boi'] = $this->db_model->get_boisson($num);
echo "true";
$this->load->view('templates/haut_administrateur.php');
$this->load->view('resp_modif_boisson',$data);
$this->load->view('templates/bas.php');
}
}else{
$data['boi'] = $this->db_model->get_all_boissons();
$this->load->view('templates/haut_accueil.php');
$this->load->view('boissons_afficher',$data);
$this->load->view('templates/bas.php');
}
}
I have editable pdf form that needs to be build for this i used mpdf, now for sample html an html with an <input type="text" name="demo"/> it workds perfectly fine it generates the required editable pdf as it should,now i have created a form the link is
http://clients.nextcrawl.co/simpleservant-form/
it is just a simple index, css and some fonts when i try to render this html into mpdf i got the following error!
Notice: Undefined index: fieldname in E:\xampp\htdocs\simpleservant-form\vendor\mpdf\mpdf\src\Form.php on line 204
Fatal error: Call to undefined method Mpdf\Mpdf::Error() in E:\xampp\htdocs\simpleservant-form\vendor\mpdf\mpdf\src\Form.php on line 829
i am fairly new with these things, so i cant really figure where the problem is, here's my full code
<?php
require_once __DIR__ . '/vendor/autoload.php';
$mpdf = new \Mpdf\Mpdf();
$html='
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="css/form.css"/>
</head>
<body>
<div class="container">
<div class="notification_form">
<div class="form-header clearfix">
<div class="align1">
<h2>
<span>ONTARIO COURT OF JUSTICE</span><br/>
COUR DE JUSTICE DE L’ONTARIO<br/>
<span>PROVINCE OF ONTARIO</span><br/>
PROVINCE DE L’ONTARIO
</h2>
</div>
<div class="align2">
<h1>NOTICE OF INTENTION TO APPEAR<br/>
<span>AVIS D’INTENTION DE COMPARAÎTRE</span></h1>
</div>
<div class="align3">
<h3>
<span class="bold">Form / Formulaire 8</span><br/>
<span class="italic-form">Provincial Offences Act</span><br/>
Loi sur les infractions provinciales
</h3>
</div>
</div>
<div class="form_content">
<div class="consent">
<div class="fields-bottom fields-1">
<div class="flex1">
<p>TAKE NOTICE THAT I,</p>
</div>
<div class="flex2">
<input type="text" class="long"/>
<div class="half-width">
<p class="italic-form">VEUILLEZE PRENDRE AVIS QUE JE SOISSIGNĖ(E)</p>
<p class="font-size-kum">(Family/Company / <span class="italic-form">nom de famille/enterprise</span>)</p>
</div>
</div>
<div class="flex3">
<input type="text"/>
<div class="half-width">
<p>(Given / <span class="italic-form">prėnom</span>)</p>
</div>
</div>
<div class="flex4">
<input type="text" class="last"/>
<div class="quarter-width">
<p class="right">(Initials / <span class="italic-form">initiales</span>)</p>
</div>
</div>
</div>
<div class="fields-bottom fields-2">
<div class="flex1">
<input type="text">
<p>(Current address / <span class="italic-form">adresse actuelle</span>)</p>
</div>
<div class="flex2">
<input type="text">
<p>(Street / <span class="italic-form">rue</span>)</p>
</div>
<div class="flex3">
<input type="text">
<p>(Apt. / <span class="italic-form">app</span>.)</p>
</div>
</div>
<div class="fields-bottom fields-2 fields-3">
<div class="flex1">
<input type="text">
<p>(Municipality / <span class="italic-form">municipalitė</span>)</p>
</div>
<div class="flex2">
<input type="text">
<p>(Province)</p>
</div>
<div class="flex3">
<input type="text">
<p>(Postal Code / <span class="italic-form">code postal</span>)</p>
</div>
</div>
<div class="fields-bottom fields-4">
<div class="flex1">
<input type="text">
<input type="text">
<input type="text">
<p>(Telephone No / <span class="italic-form">numėro du tėlėphone</span>)</p>
</div>
<div class="flex2">
<input type="text">
<p>(E-mail Address / <span class="italic-form">adresse de courriel</span>)</p>
</div>
</div>
<div class="fields-bottom fields-5">
<div class="flex1">
<input type="text">
<p>(Location # /<br/>
<span class="italic-form">emplacement #</span>)</p>
</div>
<div class="flex2">
<input type="text">
<p>(Offence number /<br/>
<span class="italic-form">numėro de l’infraction</span>)</p>
</div>
<div class="flex2">
<input type="text">
<p>(Offence date: day/month /<br/>
<span class="italic-form">date de l’infraction:jour/mois</span>)</p>
</div>
</div>
<span>wish to give notice of my intention to appear in court to enter a plea of not guilty at the time and place set for the trail respecting the charge set out in the
Offence Notice or Parking Infraction Notice.</span>
<span class="italic-form">dėsire donner avis de mon intention de comparaître devant le tribunal pour inscrire un plaidoyer de non-culpabilitė à l’heure et au lieu prėvus pour
le procės en rėponse à l’accusation ėnoncėe dans l’avis d’infraction ou l’avis d’infraction de stationnement.</span>
<div class="court fields-bottom">
<div class="block">
<input type="radio" name="appear"/>
<p>I intend to appear in court to enter a plea at the time and place set for the trial and I wish that it be held in the English lanuage</p>
</div>
<div class="block">
<input type="radio" name="appear"/>
<p class="italic-form">J’ai l’intention de comparaître decant le tribunal pour inscrire un plaidoyer à l’heure et au lieu prėvus pour le precės et je dėsire que le procės
se dėroule en francais</p>
</div>
</div>
<div class="fields-bottom fields-6">
<div class="flex1">
<p>I request a</p>
<input type="text">
<p>language interpreter for the trial.</p>
</div>
<div class="flex2">
<p>(leave blank if inaplicable)</p>
</div>
</div>
<div class="fields-bottom fields-6 fields-7">
<div class="flex1">
<p class="italic-form">Je demande l’aide d’un interprėte de langue</p>
<input type="text">
<p class="italic-form">pour le precės.</p>
</div>
<div class="flex2">
<p class="italic-form">(à remplir, s’il y a lieu)</p>
</div>
</div>
<div class="sign">
<div class="sign1">
<p><span>Note:</span> if you <span>fail to notify</span> the court office of <span>address changes</span> you may not
receive important notices e.g., your Notice of trial. You may be convicted in
your absence if you do not attend the trial.</p>
<input type="text"/>
<p class="sign-p">Signature of defendant /<br/>
<span class="italic-form">signature du dėfendeur / de la dėfenderesse</span> </p>
</div>
<div class="sign2">
<p class="italic-form"><span>Remarque:</span> Si vous <span>omettez de prėvenir</span> le greffe du tribunal de
<span>tout changement d’adresse</span>, vous pouriez ne pas recevoir
d’importants avis (p.ex.,votre avis de procės). Vous pourriez
ėtre dėclarė(e) coupable en votre absence si vous n’assistez pas
au procės.</p>
<p class="middle">Date</p>
<input type="text" class="middle"/>
</div>
</div>
</div>
<div class="border-parent">
<div class="dashed-border"></div>
</div>
<div class="consent">
<div class="banda-sign">
<p>Representative’s Name & Address / <span class="italic-form">non et adresse du reprėsentant / de la reprėsentate</span></p>
</div>
<div class="fields-bottom fields-8">
<div class="flex1">
<input type="text">
<p>(Name / <span class="italic-form">nom</span>)</p>
</div>
</div>
<div class="fields-bottom fields-2 fields-9">
<div class="flex1">
<input type="text">
<p>(Current address / <span class="italic-form">adresse actuelle</span>)</p>
</div>
<div class="flex2">
<input type="text">
<p>(Street / <span class="italic-form">rue</span>)</p>
</div>
<div class="flex3">
<input type="text">
<p>(Apt. / <span class="italic-form">app</span>.)</p>
</div>
</div>
<div class="fields-bottom fields-2 fields-3 fields-9">
<div class="flex1">
<input type="text">
<p>(Municipality / <span class="italic-form">municipalitė</span>)</p>
</div>
<div class="flex2">
<input type="text">
<p>(Province)</p>
</div>
<div class="flex3">
<input type="text">
<p>(Postal Code / <span class="italic-form">code postal</span>)</p>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>';
$mpdf->useActiveForms = true;
//$mpdf->formUseZapD = false;
//$mpdf->form_border_color = '0.6 0.6 0.72';
//$mpdf->form_button_border_width = '2';
//$mpdf->form_button_border_style = 'S';
//$mpdf->form_radio_color = '0.0 0.0 0.4'; // radio and checkbox
//$mpdf->form_radio_background_color = '0.9 0.9 0.9';
$mpdf->WriteHTML($html,0);
$mpdf->Output();
//$mpdf->WriteHTML($html);
//// OUTPUT
//$mpdf->Output(); exit;
i am indeed using composer for library management , can anyone help what maybe the issue?
The Call to undefined method Fatal error is fixed in a fresh version 7.1.6, upgrade from composer.
As to the undefined index, file an issue in mPDF Github issue tracker.
I been trying to figure out where my mistake is without success. I get no reported errors. I want to insert data into the supplier table from a PHP form. id_drugstore is a foreign key into the supplier table and can be chosen form a drop-down list (drop-down is working perfect). Another date is filled in by the user, except id_supplier.
<?
error_reporting(-1);
$conn = mysqli_connect("localhost", "root", "", "retete");
if(mysqli_connect_errno())
{
echo "Nu ma pot conecta la baza de date medical:" .mysqli_connect_error();
}
if(isset($_POST['submit']){
$id_drugstore=$_POST['id_drugstore'];
$name_suplier=$_POST['name_suplier'];
$country_supplier=$_POST['county_supplier'];
$county_supplier=$_POST['county_supplier'];
$town_supplier=$_POST['town_supplier'];
$street_supplier=$_POST['street_supplier'];
$bank_suplier=$_POST['bank_suplier'];
$no_cont_Bank=$_POST['$no_cont_Bank'];
$qry=mysqli_query("INSERT INTO supplier `VALUES('sss','%$id_drugstore%',$_POST['name_suplier']','$_POST['county_supplier']','$_POST['county_supplier']','$_POST['town_supplier']','$_POST['street_supplier']','$_POST['bank_suplier']','$_POST['$no_cont_Bank']";`
$inserted=($qry,$conn);
if($inserted){
echo "Datele au fost inserate cu suucess";
}else{
echo "datele nu au putut fi salvate in baza de date".mysqli_error($conn);
}
}
mysqli_close($conn);
}
?>
<body>
<div class="jumbotron">
<div class="container">
<h4 class="display-5">Adaugare Furnizori in baza de date</h4>
<p class="lead">Completati formularul de mai jos</p>
</div>
</div>
<form action="AdaugareFurnizori.php" method="POST">
<div class="form-row">
<div class="col-md-2 mb-3">
<label for="validationServer01">Farmacie</label>
<select name="name_drugstore">
<option>Selecteaza farmacie</option>
<?php
$conn = mysqli_connect("localhost", "root", "", "retete");
if(mysqli_connect_errno()){
echo "Nu ma pot conecta la baza de date medical:".mysqli_connect_error();
}
$q=mysqli_query($conn,"SELECT * FROM drugstore")or die(mysqli_error());
$c=mysqli_num_rows($q);
if($c==0){
echo 'Nu exista farmacie in baza de date';
}else{
while($row=mysqli_fetch_array($q)){
$id_drugstore=$row['id_drugstore'];
$name_drugstore=$row['name_drugstore'];
echo "<option value='$id_drugstore'>$id_drugstore/$name_drugstore<option>
}
}
mysqli_close($conn);
?>
</select>
</div>
</div>
<div class="form-row">
<div class="col-md-4 mb-3">
<label for="validationServer01">Denumire Furnizori</label>
<input type="text" name="name_suplier" class="form-control is-valid" id = "validationServer01" placeholder="Denumire Furnizor" required>
</div>
</div>
<div class="form-row">
<div class="col-md-2 mb-3">
<label for="validationServer02">Tara</label>
<input type="text" name="country_supplier" class="form-control is-valid" id="validationServer02" placeholder="Tara" required>
<div class="invalid-feedback">
Va rugam sa introduceti tara.
</div>
</div>
<div class="col-md-2 mb-3">
<label for="validationServer03">Judet</label>
<input type="text" name="county_supplier" class="form-control is-valid" id="validationServer03" placeholder="Judet" required>
<div class="invalid-feedback">
Va rugam sa introduceti judetul.
</div>
</div>
<div class="col-md-2 mb-3">
<label for="validationServer04">Oras</label>
<input type="text" name="town_supplier"class="form-control is-valid" id="validationServer04" placeholder="Oras" required>
<div class="invalid-feedback">
Va rugam sa introduceti orasul.
</div>
</div>
<div class="col-md-2 mb-3">
<label for="validationServer05">Strada si numar</label>
<input type="text" name="street_supplier" class="form-control is-valid" id="validationServer05" placeholder="Strada" required>
<div class="invalid-feedback">
Va rugam sa introduceti strada.
</div>
</div>
<div class="col-md-2 mb-3">
<label for="validationServer04">Banca</label>
<input type="text" name="bank_suplier"class="form-control is-valid" id="validationServer04" placeholder="Denumire Banca" required>
<div class="invalid-feedback">
Va rugam sa introduceti banca.
</div>
</div>
<div class="col-md-2 mb-3">
<label for="validationServer05">Cont</label>
<input type="text" name="no_cont_Bank" class="form-control is-valid" id="validationServer05" placeholder="Numar Cont" required>
<div class="invalid-feedback">
Va rugam sa introduceti numarul contului.
</div>
</div>
<div class="submit">
<button class="btn btn-primary" type="submit">Submit form</button>
</div>
</div>
</form>
</body>
</html>
That query looks strange:
$qry=mysqli_query("INSERT INTO supplier `VALUES('sss','%$id_drugstore%',$_POST['name_suplier']','$_POST['county_supplier']','$_POST['county_supplier']','$_POST['town_supplier']','$_POST['street_supplier']','$_POST['bank_suplier']','$_POST['$no_cont_Bank']";`
Remove the backticks `
Missing an opening ' before $_POST['name_suplier']'
All of your $_POST variables in that string will never get replaced, put them in curly brackts: {$_POST['name_suplier']}
Make sure you have no typos in there name_suplier vs. town_supplier
Missing a closing bracket at the end of the query AND as a closing bracket for mysql_query()
Side note: Shouldn't there be a list of fields in that INSERT too?
your code should be.
If your supplier table have all this field which you are going to insert then this will works fine but if u skip any of the field then mysqli_query does not work
$qry="INSERT INTO supplier `VALUES('sss','%$id_drugstore%',$_POST['name_suplier']','$_POST['county_supplier']','$_POST['county_supplier']','$_POST['town_supplier']','$_POST['street_supplier']','$_POST['bank_suplier']','$_POST['$no_cont_Bank']')";
$inserted=mysqli_query($qry,$conn);
there are some simply task and take me crazy, I've searched around sites an the solutions i've found not work or I've some not configured correctly in my enviroonment.
Well, i've a simple form in html, the form have his name (accessForm) and his inputs too, there are the form's code
<form action="admin#updateProfile" method="post" role="form" name="accessForm" class="smart-form">
<header>
Datos de acceso a la red
</header>
{% if error != '0' %}
<div class="alert alert-danger">
×
<strong>Hay algún error<br/></strong> {{ error }}
</div>
{% endif %}
<fieldset>
<section>
<label class="label">Nombre de usuario</label>
<label class="input">
<input type="text" maxlength="25" name="nombreUsuario" value="{{ userData.username }}">
</label>
<div class="note">
<strong>Nombre de usuario:</strong> es el nombre con el que puedes loguearte en la red SEMB, si cambias este dato, tu sesión finalizará automáticamente y tendrás que volver a loguearte.
</div>
</section>
<section>
<label class="label">Contraseña</label>
<label class="input">
<input type="password" maxlength="50" name="password">
</label>
<div class="note">
<strong>Tu contraseña de acceso:</strong> deja este campo en blanco si no quieres cambiar tu contraseña. Si la cambias, tu sesión finalizará y tendrás que volver a loguearte.
</div>
</section>
<section>
<label class="label">Correo electrónico</label>
<label class="input">
<input type="text" maxlength="80" name="email" value= "{{ userData.email }}">
</label>
<div class="note">
<strong>Correo electrónico:</strong> es fundamental que sea un correo válido ya que ahí recibirás las notificaciones (si quieres claro), también puedes usar el e-mail para loguearte en la red.
</div>
</section>
<section>
<label class="toggle">
<input type="checkbox" name="recibirNotificaciones" {{ userData.recibirNotificaciones }}>
<i data-swchon-text="SI" data-swchoff-text="NO"></i> deseo recibir notificaciones por e-mail
</label>
</section>
</fieldset>
<header>
Configuración de apariencia
</header>
<fieldset>
<section>
<label class="label">Fondo para el perfil de usuario</label>
<div class="carousel-inner">
<div class="item active">
<img id="background" src="../img/backgrounds/{{ userData.background }}" alt="">
</div>
</div>
<label class="label">Cambiar fondo</label>
<label for="file" class="input input-file">
<div class="button"><input id="imgBackground" type="file" name="backgroundFile" onchange="this.parentNode.nextSibling.value = this.value">Cargar</div><input type="text" placeholder="Selecciona un fichero desde tu ordenador" readonly="">
</label>
</section>
<section>
<label class="label">Avatar</label>
<div class="profile-pic">
<img id="avatar" src="../img/avatars/{{ userData.avatar }}" alt="">
</div>
<label class="label">Cambiar avatar</label>
<label for="file" class="input input-file">
<div class="button"><input id="imgAvatar" type="file" name="avatarFile" onchange="this.parentNode.nextSibling.value = this.value">Cargar</div><input type="text" placeholder="Selecciona un fichero desde tu ordenador" readonly="">
</label>
</section>
</fieldset>
<footer>
<button type="submit" name="send" class="btn btn-primary">
Guardar cambios
</button>
</footer>
</form>
This form is POST method and action calls to a route. This route aims to a controller, in the action of this controller, I've put a simple variable to get the value of $request.
public function UpdateProfileAction(Request $request)
{
$error = "0";
$data = $request->request->all();
Well, $request->request-all() ALWAYS returns empty array
What are wrong in my Form?
NOTE: If I change the form method to GET, the $data variable in controller returns array correctly (change the attribute request by query instead)
Thanks in advance.
i have a problem with the validation form. It does not work if i put "required", example:
controller:
public function updateBenefit(){
$result = array();
$this->load->helper(array('form', 'url'));
$this->load->library('form_validation');
$this->form_validation->set_rules('beneficio', 'Nombre del Beneficio', 'required|alpha');
$this->form_validation->set_rules('info', 'Info', 'alpha');
$this->form_validation->set_rules('descrip', 'Descripción', 'alpha');
$this->form_validation->set_rules('orden', 'Orden', 'integer');
// $this->form_validation->set_rules('fecha', 'Fecha', 'date_valid');
$this->form_validation->set_message('required', 'El campo %s es requerido');
if ($this->form_validation->run() == TRUE){
if (isset($_POST['id'])){
$idb = $_POST['id'];
$benefit = BeneficiosManager::getInstance()->getHome($idb);
$result['message'] = "Se ha modificado el Beneficio con éxito";
} else{
$benefit = BeneficiosManager::getInstance()->create();
$result['message'] = "Se ha cargado el Beneficio con éxito";
}
$benefit->nombre = ucfirst(strtolower($_POST['beneficio']));
$benefit->content = ucfirst(strtolower($_POST['descrip']));
$benefit->intro = ucfirst(strtolower($_POST['info']));
$benefit->active = $_POST['optionsRadios2'];
$benefit->orden = $_POST['orden'];
// $benefit->date = $_POST['fecha'];
BeneficiosManager::getInstance()->save($benefit);
}else{
//no se validaron los datos ingresados
$result['message'] = "Error validación";
}
echo json_encode($result);
}
view:
{extends file='admin/base/base.tpl'}
{block name='content'}
<h3>Cargar Beneficio </h3>
</br>
<form action="{site_url()}admin/updateBenefit" class="form-horizontal" method="post" id="" enctype="multipart/form-data">
<div class="control-group">
<label class="control-label">Beneficio</label>
<div class="controls">
<input type="text" name="beneficio" value="" class="m-wrap medium" />
<span class="help-inline">Nombre del Beneficio</span>
</div>
</div>
<div class="control-group">
<label class="control-label">Info</label>
<div class="controls">
<textarea name="info" class="medium m-wrap" rows="3"></textarea>
<span class="help-inline">Información Clave</span>
</div>
</div>
<div class="control-group">
<label class="control-label">Descripción</label>
<div class="controls">
<textarea name="descrip" class="large m-wrap" rows="3"></textarea>
<span class="help-inline">Descripción del Beneficio</span>
</div>
</div>
<div class="control-group">
<label class="control-label">Activo</label>
<div class="controls">
<label class="radio line">
<input type="radio" name="optionsRadios2" value="1"/>Si</input>
</label>
<label class="radio line">
<input type="radio" name="optionsRadios2" value="0"/>No</input>
</label>
<span class="help-inline">Ofrecer Beneficio</span>
</div>
</div>
<div class="control-group">
<label class="control-label">Orden</label>
<div class="controls">
<input type="text" name="orden" value="" class="m-wrap small" />
<span class="help-inline">Prioridad del Beneficio</span>
</div>
</div>
<div class="control-group">
<label class="control-label">Fecha</label>
<div class="controls">
<input type="text" name="fecha" value="{$smarty.now|date_format}" class="m-wrap medium" />
<span class="help-inline"></span>
</div>
</div>
<div class="form-actions">
<button type="submit" class="btn blue"><i class="icon-ok"></i> Guardar</button>
<button type="button" class="btn">Cancelar</button>
</div>
</form>
{/block}
what might the problem be?
if i remove the "required" field, the form validates... but if i put it, it doesn't... i don't know what else to try, can't understand why this is happening
the code is working now, thanks to #Jonathan that corrected me, and i was also making an imput mistake when i was trying this method. I was trying to put two words in the same field (i.e: bon vivir); so the correct input would be: bonvivir.
I'm not sure you are using "title" as the name of your real title input element. Because I found you use this code to assign your title.
$benefit->title = ucfirst(strtolower(trim($_POST['beneficio'])));
So you may want to try to use
$this->form_validation->set_rules('beneficio', 'Nombre del Beneficio', 'required|alpha');
instead.
I am not sure I had the right guess. Just give it a go. Hope this helps.