The clever 1 Report post Posted March 4, 2012 I have this assignment from college. I have to admit i am pretty week in php programming. HTML was way too easy. It had been three days trying to solve this one but I coudn't figure it out in the combo box for now, and freankly I have no idea how to display the last table shown in this thread. I need to store these data in an array and then display it in a combo box: The combo box will appear like this (notice: The third book "photoshop" must be displayed as the default book(selected)): And finally I need to display the following table using the list and eachfunctions with while loop: PLEASE HELP ME... THANK YOU Share this post Link to post Share on other sites
The clever 1 Report post Posted March 4, 2012 This my solution for now.. but I didn't know how to dispaly it in a combo box or in the table <html> <body> <table border=2 cellspacing=2 cellpadding=2 align="center"> <tr> <td>Choose a book</td> <td> <select name="books"> <?php $books=array( HD=> array( 'bkid'=>'100', 'bktitle'=>'Computer Hardware', 'bkprice'=>'12.250', 'discount'=>'0.10'), OS=> array( 'bkid'=>'200', 'bktitle'=>'Operating System', 'bkprice'=>'25.5', 'discount'=>'0.15'), PS=> array( 'bkid'=>'300', 'bktitle'=>'Photoshop', 'bkprice'=>'8.3', 'discount'=>'0.20')); //From here It's probalby wrong foreach($books as $key => $value){ $value[bkid]." - ".$value[bktitle]." -OR ".$value[bkprice]." - ".$value[discount]."<br>"; echo "<option></option>"; // I don;t know what to do here } ?> </select> </td> </tr> </body> </html> Share this post Link to post Share on other sites
The Last Wicked 251 Report post Posted March 4, 2012 Can't see the posted image.... Share this post Link to post Share on other sites
The clever 1 Report post Posted March 4, 2012 I don't know much of image hosts>>> This is the link to the array: http://i.imgur.com/IAb3b.jpg The combo box will appeare like this taking in consideration that 'photoshop' is the default selected http://i.imgur.com/iF0QM.jpg and the table: http://i.imgur.com/qRcxH.jpg Other Links: 1 Share this post Link to post Share on other sites
tariq1 1 Report post Posted June 16, 2012 It may be helpful, I will tell again. <html> <body> <table border=2 cellspacing=2 cellpadding=2 align="center"> <tr> <td>Choose a book</td> <td> <select name="books"> <?php $books=array( HD=> array( 'bkid'=>'100', 'bktitle'=>'Computer Hardware', 'bkprice'=>'12.250', 'discount'=>'0.10'), OS=> array( 'bkid'=>'200', 'bktitle'=>'Operating System', 'bkprice'=>'25.5', 'discount'=>'0.15'), PS=> array( 'bkid'=>'300', 'bktitle'=>'Photoshop', 'bkprice'=>'8.3', 'discount'=>'0.20')); //From here It's probalby wrong foreach($books as $key => $value){ // $value[bkid]." - ".$value[bktitle]." -OR ".$value[bkprice]." - ".$value[discount]."<br>"; echo "<option>".$value[bkid]." - ".$value[bktitle]." -OR ".$value[bkprice]." - ".$value[discount]."</option><br>"; // I don;t know what to do here } ?> </select> </td> </tr> </body> </html> Share this post Link to post Share on other sites
CyberAbc 290 Report post Posted June 20, 2012 bro u can create that table by gui mode by using phpmyadmin on wamp/mamp/lamp server based on what os u r using and then copy the code and use in php. 1 Share this post Link to post Share on other sites