PDA

View Full Version : how do not submit query


mppavlov
02-22-2005, 04:12 PM
Hi,
Bascially i have written a cgi script to work with dbi. I have one page with the options from which the user selects the ones to search the database for. This page has a submit button-which when pressed displays the results from the database. However i need the program to work so that if the user selects no options-when the submit button is pressed-it does not display the results page- but stays on the same (initial search) page.
Any help is gratefully accepted.

the code is basically these 2 parts:

unless(param()) {
{blah blah options code}
submit,
end_form,
hr;
}

if(something){

print results
}

mlseim
02-23-2005, 09:36 PM
Use Javascript on your form to check for empty fields.

Search Google: Javascript form validation

andyede
02-24-2005, 09:18 AM
java script would do the job great

if(something){
print results
}else{
print redirect('http://www.domain.net/cgi-bin/script.cgi');
}

would probably be faster for you to do but would wipe the form as all it does is rewrite the page.