Page 1 of 1

I'm not sure what is the proper way to do this.

Posted: Mon Sep 22, 2008 11:47 am
by zunebuggy
After a user queries my database, if the query returns one or more results, I simply display the results. But if it returns zero results, I want the user to have the option of saving their search. This requires that on the if !$results, that I either print or echo a web page that includes the form to submit and save the query... OR do I have this page (with the form) already on my site and the if !$results simply redirects to that page. I just do not know which is best "netiquite" or which is best programatically? I want my site to have good flow and allow the users many logical options to get off pages without clicking the Back button. Thank you.

Re: I'm not sure what is the proper way to do this.

Posted: Mon Sep 22, 2008 1:48 pm
by onion2k
Moved to PHP - Code.

Re: I'm not sure what is the proper way to do this.

Posted: Mon Sep 22, 2008 2:09 pm
by califdon
zunebuggy wrote:After a user queries my database, if the query returns one or more results, I simply display the results. But if it returns zero results, I want the user to have the option of saving their search. This requires that on the if !$results, that I either print or echo a web page that includes the form to submit and save the query... OR do I have this page (with the form) already on my site and the if !$results simply redirects to that page. I just do not know which is best "netiquite" or which is best programatically? I want my site to have good flow and allow the users many logical options to get off pages without clicking the Back button. Thank you.
How do you plan to "save" the search terms? In a database? For how long? I don't understand the difference between your 2 approaches, they both sound the same to me. If your goal is to minimize the steps a user must take, I think I would not have a separate page at all. Presumably your user is already identified and you have the search terms, why not either have one button to click and save the data, or even just always save a search that returned no results, without even asking the user? And how do you plan to present previous no-results searches to the user? I don't think there's any netiquette issue involved. Just your concept of what you want your users to be able to do.

Re: I'm not sure what is the proper way to do this.

Posted: Mon Sep 22, 2008 2:52 pm
by zunebuggy
Their query will be saved in a separate table in my database indexed by their unique unsername. After my If !$results statement, I adding what basically consists of an entire web page with a form, by using the echo command. It just seems like it is actually easier to create this page in HTML and use, I believe, the header command to redirect the user to this page? But I am not sure if this the correctway to do it?

Re: I'm not sure what is the proper way to do this.

Posted: Mon Sep 22, 2008 2:56 pm
by califdon
zunebuggy wrote:Their query will be saved in a separate table in my database indexed by their unique unsername. After my If !$results statement, I adding what basically consists of an entire web page with a form, by using the echo command. It just seems like it is actually easier to create this page in HTML and use, I believe, the header command to redirect the user to this page? But I am not sure if this the correctway to do it?
Why do you need another web page and form? What other information would you ask the user for that you don't already have? If you are trying to make things easier for users, you shouldn't require additional operations unless there is something you need to store in the database that you don't already know.

You can't send a header to a browser after you have sent even one character, so you would need to use another method of redirecting, but again, I don't see why you need to do this.