Hello, I have a bit of a problem here:
My database table, called tanya, in a database named tanya, has the following structure:
+---------+---------+------+-----+------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------+---------+------+-----+------------+----------------+
| ID | int(11) | | PRI | 0 | auto_increment |
| date | date | | | 0000-00-00 | |
| title | text | YES | | NULL | |
| section | text | YES | | NULL | |
| text | text | YES | | NULL | |
+---------+---------+------+-----+------------+----------------+
I'm able to create a form page with drop down menus listing the sections, and titles of my articles using the following code:
HTML>
<HEAD>
<TITLE> Manage Jokes </TITLE>
</HEAD>
<BODY>
<H1>Manage Jokes</H1>
<P><A HREF="newjoke.php">Create New Joke</A></P>
<?php
require ("dbcnx.php");
$authors = mysql_query("SELECT ID, section FROM tanya");
$cats = mysql_query("SELECT ID, title FROM tanya");
?>
<FORM ACTION="articlelist.php" METHOD=POST>
<P>View jokes satisfying the following criteria:<BR>
By Section:
<SELECT NAME="section" SIZE=1>
<OPTION SELECTED VALUE="">Any Section
<?php
while ($author = mysql_fetch_array($authors)) {
$aid = $author["ID"];
$aname = $author["section"];
echo("<OPTION VALUE='$aname'>$aname\n");
}
?>
</SELECT><BR>
By Title:
<SELECT NAME="title" SIZE=1>
<OPTION SELECTED VALUE="">Any Title
<?php
while ($cat = mysql_fetch_array($cats)) {
$cid = $cat["ID"];
$cname = $cat["title"];
echo("<OPTION VALUE='$cid'>$cname\n");
}
?>
</SELECT><BR>
<p>
<INPUT TYPE=TEXT NAME="title"><BR>
Containing Text: <INPUT TYPE=TEXT NAME="searchtext"><BR>
<INPUT TYPE=SUBMIT NAME="submit" VALUE="Search">
</FORM>
<P ALIGN=CENTER><A HREF="admin.html">Return to Front Page</A></P>
</BODY>
My question: How do I create a script to process this information, and more specifically, how can I use the SELECT statement to output a list of articles that match my query?
You can find this script at
http://www.adolescentadulthood.com/tanya/articles.php
Thanks in advance!