CodeIgniter Forums

Full Version: where to put the css in a CI3 generated form?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have a form I am trying to create and instead of using HTML I am creating (and validating) with the built in form helper. Where do I put the css in this case?

PHP Code:
   public function index()
        if ($this->form_validation->run() == FALSE)

PHP Code:
        body {font-familyArialHelveticasans-serif;}

        /* Full-width input fields */
        input[type=text] {
            padding12px 20px;
            margin8px 0;
            border1px solid #ccc;

        /* Set a style for all buttons */
        button {
            padding14px 20px;
            margin8px 0;

        button:hover {

        /* Extra styles for the cancel button */
        .cancelbtn {
            padding10px 18px;

        /* Center the image and position the close button */
        .imgcontainer {
            margin24px 0 12px 0;

        img.avatar {

        .container {

        span.psw {

        /* The Modal (background) */
        .modal {
            displaynone/* Hidden by default */
            positionfixed/* Stay in place */
            z-index1/* Sit on top */
            width100%; /* Full width */
            height100%; /* Full height */
            overflowauto/* Enable scroll if needed */
            background-colorrgb(0,0,0); /* Fallback color */
            background-colorrgba(0,0,0,0.4); /* Black w/ opacity */

        /* Modal Content/Box */
        .modal-content {
            margin5auto 15auto/* 5% from the top, 15% from the bottom and centered */
            border1px solid #888;
            width80%; /* Could be more or less, depending on screen size */

        /* The Close Button (x) */
        .close {

        .close:focus {

        /* Add Zoom Animation */
        .animate {
            -webkit-animationanimatezoom 0.6s;
            animationanimatezoom 0.6s

        @-webkit-keyframes animatezoom {
            from {-webkit-transformscale(0)}
            to {-webkit-transformscale(1)}

        @keyframes animatezoom {
            from {transformscale(0)}
            to {transformscale(1)}

        /* Change styles for span and cancel button on extra small screens */
        @media screen and (max-width300px) {
            span.psw {
            .cancelbtn {
It should go with all your other css files in assets/css
Instead of using the CI3 generated form, I switched over to include the form in a template.  Now I can get the nice form I wanted. 

Now I am battling with the $_POST and also validation. I'd like to use CI3's form validation rules. Not sure if I can in this "bastardized" form. 

I have set the submit to go to a method  in the controller:

<form action="/index.php/Users_start_login/get_email" method="post">

and i do see the $_POST. I'd like to make sure it is a valid form of an email with:

$this->form_validation->set_rules('email', 'Email', 'required|valid_email);

before I check to see if it is sent to my authentication tool. 

One idea is to use:
[font=Consolas,]if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {

  $emailErr = "Invalid email format";