eWebTalk
Home Register New Posts FAQ eWebTalk TOS/Rules Advertise eTools

Go Back   eWebTalk Community > Website Development > Website Design

Reply
 
Thread Tools Search this Thread Display Modes
Old Apr 18, 2008, 11:44 AM   #1
 
Kaashifv's Avatar


Kaashifv
Computer Guy
eArcade Awards
Join Date: Oct 2004
Location: Hamilton
Posts: 842
Yapper(s): 781926262.60 (Donate)
 
Reply With Quote

I am new to the forums, and i have been using HTMl for quite some time now. I was just wondering, i have a custom pc building form, and as of right now i am using javascript and all the items are stored in the HTML of the BODY tag.

I was wondering if there is a way i can modify the form, and have the pull down items populate from an external database.

eg.
Current

HTML Code:
<table class="cpu_content" width="800" align=center id="table1"> <tr> <td>&nbsp;</td> <td></td> <td><strong>Qty</strong></td> <td><strong>Total</strong></td> </tr> <tr class="lineitem"> <td>CD-ROM Drives:</td> <td> <select name="prod_1" class="quoteselect" onchange="updatePrice(1, this.value)"> <option value="Select:0" selected>-- Select --</option> <option value="Asus:0">--ASUS-- </option> <option value="Asus52xCD:20.0">Asus 52x CD-ROM Drive ($20.00)</option> <option value="Asus52XDBL:20.0">Asus 52x CD-ROM Drive (Black) ($20.00)</option> <option value="LG:0">--LG--</option> <option value="LG52xCD:20.0">LG 52x CD-ROM Drive ($20.00)</option> <option value="LG52xCDBL:20.0">LG 52x CD-ROM Drive (Black) ($20.00)</option> </select> </td> <td> <select name="qty_1" id="qty_1" onchange="calculateSubtotal()"> <option value="0">0</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select> </td> <td> <input id="st_1" type="text" size="5" class="subtotal" value="0.00" readonly name="T1"> </td> </tr> .....More items here.... ...Tax/Shipping/Totals will go here....

So my question would be, how could this code be modified to use a dabase to store the items for the pulldown menus, if this is possible?

I am using 1and1.com for hosting, and i belive they support, PHP, CGI, ASP, and the standard HTML.

I am not quite sure which database to use, but i would think that i would use MYSQL, unless there is a better choice?

Anyone have any ideas?

Thanks for reading!
__________________
*************************************************
We are not powerless specks of dust drifting around in the wind, blown by random destiny. We are, each of us, like beautiful snowflakes - unique, and born for a specific reason and purpose.
**************************************************
Kaashifv is offline  
View profile Send PM to user Email user View user's homepage  
Word from our Sponsor:
Old Apr 26, 2008, 11:41 PM   #2
 
Nullified's Avatar


Nullified
Will you play with me?
eArcade Awards
Join Date: Dec 2004
Location: Outer Space
Posts: 2,086
Yapper(s): 1000446092658.70 (Donate)
 
Reply With Quote

It's simple. Make the page in php and use a mysql db with a table storing the optical drives and their information (one row per drive).

You could use php's foreach function or while function to print each row. It'd look something like this:
Code:
<?php $rows = mysql_query("SELECT * FROM optical_drives"); ?> <td> <select name="prod_1" class="quoteselect" onchange="updatePrice(1, this.value)"> <?php foreach ($rows AS $row) print ' <option value="'.$row['value'].'">'.$row['name'].'</option>'; ?> </select> </td>
Or this:
Code:
<?php $rows = mysql_query("SELECT * FROM optical_drives"); ?> <td> <select name="prod_1" class="quoteselect" onchange="updatePrice(1, this.value)"> <?php while($row = mysql_fetch_array($rows, MYSQL_ASSOC)) print ' <option value="'.$row['value'].'">'.$row['name'].'</option>'; ?> </select> </td>

Your mysql table wold be named something like optical_drives and 'value' and 'name' would be the columns storing the data in each row. So each row of the table would store data (name, price, etc.) for each drive offered.
Nullified is offline  
View profile Send PM to user Email user View user's homepage  
Old Today, 7:21 AM   #3
uvwx669
Junior Member
eArcade Awards
Join Date: May 2008
Posts: 20
Yapper(s): 292.50 (Donate)
 
Reply With Quote

which is this very has foresight view in the building is braves? What were you saying?



















中国特价机票网是特价机票行业的特价机票普及、特价机票采购、特价机票技术、特价机票会展、特价机票招标行业平台是中国最大的特价机票权威网站,并 以及时的特价机票新闻、海量的特价机票资讯和独到的特价机票信息分析,为广大特价机票爱好者特价机票订制服 务是最权威的特价机票专场会议,特价机票专家为您精选的特价机票产品,迎您来展示您的特价机票产品特价机票发布服务基于特价机票经验丰富的特价机票 企划人员和准确的特价机票投放系统,特价机票可以为特价机票客户顾名思义就是忠诚与特价机票的用户,是集特 价机票客户,网络特价机票媒体,致力与打折机票厂家为一体特价机票知识应用及特价机票产品的价值升华。
__________________
网站优化
uvwx669 is offline  
View profile Send PM to user  
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump



All times are GMT -5. The time now is 6:32 PM.

Index  |  Members  |  Contact Us!  |  Referrals  |  Archive  |  Staff  | 
eWebTalk Community ©2004-2006 All Rights Reserved.   Hosted by: eVirtual Host - Host With the Best!
Powered by: vBulletin Version 3.0.7, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.