Forums

This topic is locked

Need some help using DW 8 Behaviors

Posted 20 May 2007 00:20:12
1
has voted
20 May 2007 00:20:12 Cosmin Ghidoveanu posted:
Hello. I'm trying to build a page that searches a MySQL database and the tutorial found in Dreamweaver 8's manual doesn't explain how to do what I need. That is, I want a single page for searching and displaying results which uses $_GET for its form, but no matter what I do I can't seem to get it to work right. Some hints would be really helpful.

Replies

Replied 24 May 2007 02:38:20
24 May 2007 02:38:20 Kenneth Halley replied:
if you ant a single page to do both then a few things you need to do
Before the code for the page loads you will need a conditional statement that identifies if the url used to access the page has been modified in some way to mean the page has been submitted to itself. If not it will just display the blank search form, if it has it can process the search.

To submit the search form you need tosubmit it to its own page so the target should either be set to echo $_SERVER['PHP_SELF'] or the actual file name search.php .

Obviously your form action set to use GET will have the searched data appended to the URL .

When setting it up do a little at a time- ie if the user is to have the ability to search multiple fields boxes set your search up to only allow one search at first- say a name filed as an example. Get this working. Then ad the next filed- this allows you to test your sql that you are not negating the criteria when adding more filed- you need to decide if you want to AND or OR criteria. This can be hours of fun.

When testign check the url bar to ensure the parameter you are passing is actually being sent to the server- ie its in the url request, if not there is something wrong with your form/submit code.

Can't think of much else to say without seeing it in acton to be able to help debug.

-----------------------------------
www.halleynet.co.uk

Reply to this topic