Page 1 of 1

nOOb questions

Posted: Thu Jul 22, 2010 2:08 am
by Balveda
Please be patient with me, Im just learning :oops:

I've got a form I use to search one of my db tables and return the results. The form and results pages are separate scripts. I have 3 problems that are causing me to pull my hair out.

1. If I don't enter anything in the form and hit submit, it returns all the data in the table. Is there a way to have it just refresh the form page unless something is entered?

2. Once the results page is displayed I'd like to be able to have a button or link at the bottom that will return me to the form - I have searched but I'm probably not using the correct terminology.

3. Some of the entries in the table contain foreign alphabet characters like ä á ê. These arent displaying on the results. Is there any way I can get these characters to display?

My apologies if this is kinda simple, but it's got me stumped at the moment.

Balveda

Re: nOOb questions

Posted: Thu Jul 22, 2010 9:35 am
by atsa1
Answer to:
Q:1. If I don't enter anything in the form and hit submit, it returns all the data in the table. Is there a way to have it just refresh the form page unless something is entered?

Solution: In the file that gets the Form Submit:
make selection if/else

Code: Select all

if ($search_term == "") {
echo = "What ever you like or Nothing searched";}
else {
do the search
}
Q:2. Once the results page is displayed I'd like to be able to have a button or link at the bottom that will return me to the form - I have searched but I'm probably not using the correct terminology.
Answer:
In the Result displaying file. Athe the very end of the so called "Search code" insert this:

Code: Select all

echo("<a href=\"URL_TO_YOUR_SEARCH_FILE.php\">Go back and search again</a>");
And the last question:
What encoding you use? i use this in my pages header:

Code: Select all

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
And i have ALL õäöü and else.
Hope you get the help you need. If not: Post the codes of the files here so i can help you write the script.

Re: nOOb questions

Posted: Fri Jul 23, 2010 8:17 pm
by Balveda
Many, many thanks - you helped me on all three points, and I now know the more relevant terms to search for in future.

Cheers,

Balveda