Hi all,

Just a quick question about a way to approach a situation I'm stuck in with
the intention of keeping best practices in mind.

Alright, I have a page in which a user can search for a list of people, they
can either search by name, industry, city, country or job title (eg:
programmer, plumber) each option is determined by a radio button nothing
fancy and a texfield to enter the value to search for (EG: name = bob)

My question is this:

Firstly Im trying to keep my code neat and preferably as little of it as
possible in the actual page by using javascript to call functions in another
file.

Should I:

- just have the page post to itself (the results are also displayed on the
same page) therefore having the code that does the validation of which
option was selected and ensure that a valid entry was entered (eg name must
not be blank or have an integer value for example) and then calling the
function to query the database (which is in another file)

- or should i just have the submit button for the search call a javascript
function immediately and based on whats entered then call the specific
function to query the DB. Therefore hardly any php code is in the actual
page. Relating to this is whether I can call a function in the query file
(class) to get the resultset, and how would that resultset be sent to the
origional search page.

- use another approach which i might not be aware of??

By using best practices, in future it will be easier to modify this code and
also easier to debug it. It just seems cleaner when the php code is
seperated from the actual search page (HTML), unfortunately Im not using
smarty...

any comments and help will be appreciated!
thanx in advance.

Angelo

--------------------------------------------------------------------
Disclaimer 
This e-mail transmission contains confidential information,
which is the property of the sender.
The information in this e-mail or attachments thereto is 
intended for the attention and use only of the addressee. 
Should you have received this e-mail in error, please delete 
and destroy it and any attachments thereto immediately. 
Under no circumstances will the Cape Technikon or the sender 
of this e-mail be liable to any party for any direct, indirect, 
special or other consequential damages for any use of this e-mail.
For the detailed e-mail disclaimer please refer to 
http://www.ctech.ac.za/polic or call +27 (0)21 460 3911

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to