princebana Posted October 24, 2007 Share Posted October 24, 2007 hi guys im doing an assignment for my internet commerce project... im having some difficulty... please help if u can... ive to submit it tom. This involves the development of an online bookstore which is able to display a list of available books, allow orders to be made, capture relevant customer information and provide order confirmation. A shared production database called IC2A2_07.mdb has been set up in the server’s wwwroot folder. For coding purposes, this database will be referred to as IC2A207. This database has two tables, namely, the products table and the customers table. The products table stores information about the products (i.e. books) available for sale, whereas the customers table stores information about customers who place orders. Currently, the products table contains information about 8 books. In addition, to other fields, each book in the products table in the IC2A2_07.mdb database has a field called coverart the value of which refers to the jpg file name which is the book cover image of the respective book. the zip has been attached. i need to write a php file called books.php which is invoked from the welcome.html file and which queries the products table and displays the book information it contains. Information about books must be displayed in a tabular format. each book has a unique identifier (i.e. ID). In the products table this identifier is represented by a field called productID (see Figures 2, 3). each book must be shown on a separate row (see Figures 4, 5). At the end of the row a radio button must be displayed allowing customers to select the desired book before it can be ordered. we assume that only ONE book can be purchased with any single order. An Order this Book button should be shown at the bottom of the table. When customers click on the Order this Book button (in books.php file), a checkout form called order.php must be called. Your “Check Out” form it must not accept the customer’s submission for further processing unless the following validation criteria are fulfilled: 1) no form fields are to be left blank; 2) only valid Australian states and territories (i.e. SA, VIC, WA, NSW, QLD, TAS, NT and ACT) should be allowed as valid entries of the State field, and 3) only post codes of four digits must be accepted as valid Australian post codes. When the user clicks on the Submit button of the order.php checkout form (see Figure 6), file called confirmation.php should be invoked. This file must have two main responsibilities. First it should populate the customers table: for example, the data that the customer provides in the checkout form (e.g. in Figure 6) must be inserted into the customers table as shown in Figure 8. Note that the orderID field is not part of the order.php form. But you still need to insert an orderID for all your customers in order for you to be able to identify your own entries in the customers table. An orderID should be composed of three parts: 1) your franchise id (e.g. a1234567), 2) a hyphen (e.g. “-“), and 3) the productID of the selected book. The code below provides an example of how this can be implemented: $orderID=”a1234567”.”-“.$productID; where $orderID is a php variable declared and used in confirmation.php “a1234567” is a string with your franchise id; “-“ is a hyphen treated as a string, and, $productID is variable which captures the ID of the selected book in products. the files have been attached... but for some reason theyre not working... thanks prasen [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/74538-bookstore-help/ Share on other sites More sharing options...
teng84 Posted October 24, 2007 Share Posted October 24, 2007 please don't post your tread like that. what is that a novel jk lol please make it brief and understandable ! Quote Link to comment https://forums.phpfreaks.com/topic/74538-bookstore-help/#findComment-376761 Share on other sites More sharing options...
PHP_PhREEEk Posted October 24, 2007 Share Posted October 24, 2007 If you need all of that, and by tomorrow... I'd suggest a post in the Freelance section, and have a generous wallet available. PhREEEk Quote Link to comment https://forums.phpfreaks.com/topic/74538-bookstore-help/#findComment-376770 Share on other sites More sharing options...
princebana Posted October 24, 2007 Author Share Posted October 24, 2007 hey guys common... atleast help me out with books.php... Quote Link to comment https://forums.phpfreaks.com/topic/74538-bookstore-help/#findComment-376776 Share on other sites More sharing options...
teng84 Posted October 24, 2007 Share Posted October 24, 2007 post your prob one by one and trust me you'll get some help Quote Link to comment https://forums.phpfreaks.com/topic/74538-bookstore-help/#findComment-376778 Share on other sites More sharing options...
princebana Posted October 24, 2007 Author Share Posted October 24, 2007 thanks... ok this is books.php --------------- <html> <body bgcolor="#87CEFA"> <form method="post" action="welcome.html"> <h1 align="center"> Available Books</h1><hr> <h4 align="center"> Please select the book that you would like to purchase form this list below:</h4> <br><br> <META http-equiv=Content-Type content="text/html; charset=windows-1252"> <META http-equiv=expires content=0 <meta> <META http-equiv=cache-control content=no-cache> <SCRIPT language=JavaScript> function validateForm(myForm){ var select=0 </SCRIPT> <?php $conn=odbc_connect('IC2A207','',''); if(!$conn){ exit("connection failed: " . $conn); } $sql="SELECT * FROM products"; $rs=odbc_exec($conn,$sql); if(!$rs){ exit("error in SQL"); } print "<table><tr>"; print "<th>product ID</th>"; print "<th>title</th>"; print "<th>authors</th>"; print "<th>publishdate</th>"; print "<th>edition</th>"; print "<th>isbn</th>"; print "<th>coverart</th>"; print "<th>covert</th>"; print "<th>price</th>"; print "<th><input type=\"radio\" name=\"selected\"</th></tr>"; while(odbc_fetch_row($rs)) { $productID=odbc_result($rs,"productID"); $title=odbc_result($rs,"title"); $authors=odbc_result($rs,"authors"); $publishDate=odbc_result($rs,"publishDate"); $edition=odbc_result($rs,"edition"); $isbn=odbc_result($rs,"isbn"); $coverart=odbc_result($rs,"coverart"); $description=odbc_result($rs,"description"); $price=odbc_result($rs,"price"); $category=odbc_result($rs,"category"); print "<tr><td>$productID</td>"; print "<td>$title</td>"; print "<td>$authors</td>"; print "<td>$publishDate</td>"; print "<td>$edition</td>"; print "<td>$isbn</td>"; print "<td>$coverart</td>"; print "<td>$description</td>"; print "<td>$price</td>"; print "<td>$category</td></tr>"; } odbc_close($conn); echo"</table>"; ?> <!--what form should be put--> <input type="submit" value="order this book></form> </body> </html> -------------- it doesnt seem to run... can any1 figure out wat the problem is...? Quote Link to comment https://forums.phpfreaks.com/topic/74538-bookstore-help/#findComment-376781 Share on other sites More sharing options...
princebana Posted October 24, 2007 Author Share Posted October 24, 2007 one more thing... the db is in wwwroot folder... does that make a diff? also, ive named the recordset as $rs... Quote Link to comment https://forums.phpfreaks.com/topic/74538-bookstore-help/#findComment-376783 Share on other sites More sharing options...
princebana Posted October 24, 2007 Author Share Posted October 24, 2007 the output of books.php is: "; while(odbc_fetch_row($rs)) { $productID=odbc_result($rs,"productID"); $title=odbc_result($rs,"title"); $authors=odbc_result($rs,"authors"); $publishDate=odbc_result($rs,"publishDate"); $edition=odbc_result($rs,"edition"); $isbn=odbc_result($rs,"isbn"); $coverart=odbc_result($rs,"coverart"); $description=odbc_result($rs,"description"); $price=odbc_result($rs,"price"); $category=odbc_result($rs,"category"); print "$productID"; print "$title"; print "$authors"; print "$publishDate"; print "$edition"; print "$isbn"; print "$coverart"; print "$description"; print "$price"; print "$category"; } odbc_close($conn); echo""; ?> <input type="submit" value="order this book> Quote Link to comment https://forums.phpfreaks.com/topic/74538-bookstore-help/#findComment-376785 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.