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.
CodePudding user response:
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');
}
CodePudding user response:
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:
- Reboot the Server
- Check for Unexpected Maintenance
- Server Connectivity Issues
- Improper Firewall Configuration
- Check the Logs
- Application Code or Script Bugs
For more information follow these websites .
- https://airbrake.io/blog/http-errors/503-service-unavailable
- 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.