1

I am using Codeigniter framework.

My issue is:-

when I submit my booking form its shows me 503 service unavailable page if form fields are empty.

If all form fields have value then form is success fully submitting.

KUMAR
  • 1,993
  • 2
  • 9
  • 26
Yadhu Babu
  • 1,503
  • 2
  • 13
  • 25

2 Answers2

1

You do this by varrious ways:-

(1) Form Validation

you need to set rules for input fields

$this->form_validation->set_rules('username', 'Username', 'required');
if ($this->form_validation->run() == FALSE)
  {
    //run your code on success here
  }
else
  {
    //run your code on failure here
  }

(2) By if else statement Condition.

 if ($_POST) {
        $data = array(
            'category' => $this->input->post('category'),
            'name' => $this->input->post('name'),
            'description' => $this->input->post('description'),
           );
        $this->model_name->method_name($data);
        redirect(base_url().'Controller/method/');
    } else {
     redirect(base_url().'Controller/method');
         }
KUMAR
  • 1,993
  • 2
  • 9
  • 26
  • i have done this server side validation. Not for all fields only for required fields. when I removed this if statement everything works fine – Yadhu Babu Sep 11 '21 at 11:28
0

Here are some additional tips to help you troubleshoot what might be causing the 503 Service Unavailable to appear on the server-side of things:

  1. Reboot the Server
  2. Check for Unexpected Maintenance
  3. Server Connectivity Issues
  4. Improper Firewall Configuration
  5. Check the Logs
  6. Application Code or Script Bugs

For more information follow these websites .

  1. https://airbrake.io/blog/http-errors/503-service-unavailable
  2. https://askphpquestions.com/2020/11/30/getting-503-service-unavailable-on-codeigniter-in-apache-server/

I will send proper solution regarding form handling. If possible please share code snippet.

Harsh Mendapara
  • 303
  • 2
  • 10