View Single Post
 
Old May 3rd, 2004, 04:44 AM
richard.york's Avatar
richard.york richard.york is offline
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Hi Thomas,

This isn't a properly nested <form> tag! You've left out the start of the table.

Code:
<form method="get" action="<?php echo cnfg('deDir'); ?>search.php?doSearch=1">
    <table>
        <tr>
            <td>
                Enter Keyword:
            </td>
        </tr>
        <tr>
            <td valign="top">
                <input type="text" name="search" size="30" />
            </td>
        </tr>
        <tr>
            <td valign="top">
                Search In Category:
            </td>
        </tr>
        <tr>
            <td valign="top">
                <select name="category">
                    <option value="none">All Categories</option>
                    <?php
                        get_cat_options();
                    ?>
                </select><br />
                <input type="submit" name="submit" value="Submit" />
            </td>
        </tr>
    </table>
    <input type="hidden" name="searchType" value="keyword" />
</form>
What did I do to your code? I made it readable and XHTML conformant:
http://p2p.wrox.com/topic.asp?TOPIC_ID=4028
http://p2p.wrox.com/topic.asp?TOPIC_ID=11967

Are you using the $_GET superglobal in search.php to access the variables?

How about error reporting, is error_reporting set to E_ALL in php.ini? And does display_errors have a value of 'on' (it's turned off by default in more recent installations of PHP)? php.ini is the PHP configuration file, you can find this file in the Windows directory, open it with a text editor to make changes. Be sure to restart Apache after any changes to the file.

Ok, that all isn't going to do you any good if you aren't seeing the query string in the URL after pressing submit. You didn't tell me whether you saw the query string in the URL. If not, try modifying your mark-up like that shown so that every tag has both an opening and closing tag. I've never tried doing the GET method with the form action already containing a query string, so I dunno about that. For the sake of consistency I'd recommend you place that value in a hidden field.

hth!


Regards,
Rich

::::::::::::::::::::::::::::::::::::::::::
The Spicy Peanut Project
http://www.spicypeanut.net
::::::::::::::::::::::::::::::::::::::::::