Harriet Posted August 27, 2015 Share Posted August 27, 2015 (edited) 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 August 27, 2015 by requinix code tags instead of highlighting markup Quote Link to comment https://forums.phpfreaks.com/topic/297946-trouble-creating-a-website-with-databases/ Share on other sites More sharing options...
requinix Posted August 27, 2015 Share Posted August 27, 2015 (edited) 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 August 27, 2015 by requinix I said "then" when I meant "than", nooo Quote Link to comment https://forums.phpfreaks.com/topic/297946-trouble-creating-a-website-with-databases/#findComment-1519698 Share on other sites More sharing options...
Harriet Posted August 27, 2015 Author Share Posted August 27, 2015 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. Quote Link to comment https://forums.phpfreaks.com/topic/297946-trouble-creating-a-website-with-databases/#findComment-1519703 Share on other sites More sharing options...
TapeGun007 Posted August 27, 2015 Share Posted August 27, 2015 You still didn't say what the errors are. Quote Link to comment https://forums.phpfreaks.com/topic/297946-trouble-creating-a-website-with-databases/#findComment-1519706 Share on other sites More sharing options...
scootstah Posted August 27, 2015 Share Posted August 27, 2015 So do you mean HTML errors? Quote Link to comment https://forums.phpfreaks.com/topic/297946-trouble-creating-a-website-with-databases/#findComment-1519707 Share on other sites More sharing options...
Barand Posted August 27, 2015 Share Posted August 27, 2015 You don't close the category select until after you close the form. Move the </select> to a position before the submit button +-------> | ^ <input type='submit' name='submit' value='Search' ></br></br></br></center> | </form> | +--<-- </select> Quote Link to comment https://forums.phpfreaks.com/topic/297946-trouble-creating-a-website-with-databases/#findComment-1519718 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.