Note that there are some explanatory texts on larger screens.

plurals
  1. POHaving trouble using codeigniters form validation
    primarykey
    data
    text
    <p>So I am attempting for my first time to use CI's built in form_validation "tool" to much avail and research I can't seem to grasp it. I have everything in my view setup correctly and my controller seems to be right on... My problem is when I click the "submit" button it links to the new function but doesn't display any error messages regardless of what I put in the "name" , "email" boxes. I'm looking to have it display an error message practically anywhere right now I just need it to run through the validation and display an error message.</p> <p>Controller file</p> <pre><code>public function intelli() { $data["messages"] = ""; $this-&gt;load-&gt;view('engage_header'); $this-&gt;load-&gt;view('engage_nav'); $this-&gt;load-&gt;view('intelli/content_intelli', $data); $this-&gt;load-&gt;view('engage_footer'); } public function intelli_email() { $this-&gt;load-&gt;helper('form', 'url')); $this-&gt;load-&gt;library('form_validation'); $this-&gt;form_validation-&gt;set_rules('name_area', 'Name', 'required|alpha|xss_clean'); $this-&gt;form_validation-&gt;set_rules('email_area', 'Email', 'required|valid_email|xss_clean'); $this-&gt;form_validation-&gt;set_rules('phone_area', 'Phone', 'is_numeric|xss_clean'); if ($this-&gt;form_validation-&gt;run() == FALSE) { $data["messages"] = ""; } else { $data["messages"] = "The Email has successfully been sent"; } $this-&gt;load-&gt;view('engage_header'); $this-&gt;load-&gt;view('engage_nav'); $this-&gt;load-&gt;view('intelli/content_intelli', $data); $this-&gt;load-&gt;view('engage_footer'); } </code></pre> <p>View file</p> <pre><code>&lt;?php $this-&gt;load-&gt;helper("form"); ?&gt; &lt;div class="request_demo"&gt; &lt;div id="request_logo"&gt;&lt;/div&gt; &lt;div id="top_paragraph"&gt; Intelliship &amp; HALO deliver immediate and quantifiable ROI. Schedule a demo to learn how this transportation management software will positively impact your company&amp;apos;s bottom-line profit. &lt;/div&gt; &lt;div id="entry_box"&gt; &lt;?php echo validation_errors(); echo $messages; ?&gt; &lt;div id="request_form"&gt; &lt;?php echo form_open('/index.php/site/intelli_email')?&gt; &lt;input id="name_area" type="text" placeholder="NAME" value="" required/&gt;&lt;br/&gt; &lt;input id="email_area" type="text" placeholder="EMAIL" value="" required/&gt;&lt;br/&gt; &lt;input id="phone_area" type="text" placeholder="PHONE" value=""&gt;&lt;br/&gt; &lt;input id="submit_req" type="submit" value="SUBMIT"&gt; &lt;/form&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p></p> <p>I know the code is sloppy right now, but I'm just looking for functionality over beauty. also noted since I am loading the helper('form') inside the controller it is redundant to load it in the view. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload