Jump to content

trouble creating a website with databases


Harriet

Recommended Posts

HI, first time making a website... would really appreciate help with any errors in my code. Thanks!

 

<div id="site_content">
<div class="sidebar">

<!-- form to select what books would like to be viewed, i.e. what category? -->
<h3>Search Our Library!</h3>

<div class="form_style">

<form action='titleSearch.php' method='GET'>
<center>
<h1>Search Any Book Title: </h1>
<input type='text' size='90' name='search'>
<input type='submit' name='submit' value='Search' >
</center>
</form>

<form action='catSearch.php' method='GET'>
<center>
<h1>Search Book Categories:</h1>


<?php

// make an sql query to show all of the book titles
$titleSQL = "select class, description from l_classification order by class";

// connect to the database
require_once('dbconnect.php');

// execute the query
$rsTitle = mysql_query($titleSQL);

echo "<select name=\"class\">\n";
echo "<option value=\"all\">Show all books</option>";

// loop through all of the book titles in the record set
// while
while($row = mysql_fetch_array($rsTitle)) {
$class = $row['class'];
$description = $row['description'];
echo "\t<option value=\"$class\">$class : $description</option>\n";

}

// each record i'll display as an option in the form
// end loop



?>
<input type='submit' name='submit' value='Search' ></br></br></br></center>
</form>

</select>


</div>

</body>
</html>
Edited by requinix
code tags instead of highlighting markup
Link to comment
Share on other sites

Please use code tags instead of copying code from your editor and putting it directly into your post, like by using the button. It's much easier for us to read that way than to deal with whatever formatting you might have set up.

I've done it for you this time, please remember to do it yourself next time.

 

Now, the title says something about you having trouble? If you have a specific problem then it'd be great if you described what that problem is, rather than ask us to just look around for what it might be.

For example, are you not sure how to make your search form do an actual search? What have you tried and how did it not work?

Edited by requinix
I said "then" when I meant "than", nooo
Link to comment
Share on other sites

Sorry! First timer on this forum... The issue is that when uploading this coding onto the W3C validation site I have numerous errors showing, however I cannot resolve these without effecting the working on the page. I was wondering if I could have help pin pointing a resolving these errors.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.