Thats still a lot of code. Can't spot anything wrong with the JS stuff
- can you reduce that further?

Jörn

On Fri, Jul 24, 2009 at 6:54 AM, Field<fields...@gmail.com> wrote:
>
> Dupecheck Function
> [code]
>        function dupeCheck()
>        {
>
>                $request = 
> strtolower($this->input->get_post('bus_number',TRUE));
>
>                $action = strtolower($this->input->get_post('action',TRUE));
>
>                $results = $this->business->getBusinessbyNumber($request);
>
>                $valid = 'false';
>
>                if ($action == 'new')
>                {
>                        if (!$results)
>                        {
>                                $valid = 'true';
>                        }
>                }
>                elseif ($action == 'edit')
>                {
>                        $bus_id = $this->input->get_post('bus_id',TRUE);
>
>                        $id_search = $this->business->getBusinessbyId($bus_id);
>
>                        foreach ($id_search as $row)
>                        {
>                                $returned_number = 
> strtolower($row['bus_number']);
>                        }
>                        if ($returned_number == $request)
>                        {
>                                // Comparison made by bus_id to ensure the 
> bus_number has not
> changed.
>                                // Editing a business but not changing the 
> bus_number.
>                                $valid = 'true';
>                        }
>                        else
>                        {
>                                if (!$results)
>                                {
>                                        $valid = 'true';
>                                }
>                        }
>                }
>
>                echo $valid;
>        }
> [/code]
>
>
>

Reply via email to