473,651 Members | 2,987 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Whats the best way to do this?

Hi, I currently have a website that uses an option drop down box to
select different colours for an item before the form it is in is
submitted.

This works fine but as I am trying to advance my skills I decided to
learn PHP to use with SQL which I already know. I have yet to start but
am thinking of how to go about it and looking at some example code. The
whole thing looks easier enough but I was wondering how these option
boxs would fit into it.

I'm thinking one way to possibly do it would be an array with all the
options in. However, would it be possible to have what should be the
contents of the array as part of the table? For eg something like:

Colours
-----------
Blue,black,gree n

And also would it be possible using these to change the price of an
item? That isn't so important now but may be useful in the future,
although I can make it work another way if need be.

Any help much appreciated!

Thanks

Flic

Sep 11 '06 #1
3 1408
PHP is a server side language so you would use it to replace hard coded
<OPTION value = Blue>Blue</OPTION>
<OPTION value = Green>Green</OPTION>
<OPTION value = Black>Black</OPTION>

with colours from a database query or some other source. The HTML page
you generate doesn't care if it was hard coded or built on the fly by
PSP / ASP or anything else.

As for changing the prices would be to either embed the price in the
code somewhere
<OPTION value = Blue(14.99)>Blu e</OPTIONor as a hidden field on the
form, containing an array of the data you need...

and use javascript to change a form field value client side, or to
resubmit the page and find the correct price for the item added.
Personally I'd resubmit coz lots of people have JS turned off and
otherwise they would be able to see the data in its raw form.

Aaron

Flic wrote:
Hi, I currently have a website that uses an option drop down box to
select different colours for an item before the form it is in is
submitted.

This works fine but as I am trying to advance my skills I decided to
learn PHP to use with SQL which I already know. I have yet to start but
am thinking of how to go about it and looking at some example code. The
whole thing looks easier enough but I was wondering how these option
boxs would fit into it.

I'm thinking one way to possibly do it would be an array with all the
options in. However, would it be possible to have what should be the
contents of the array as part of the table? For eg something like:

Colours
-----------
Blue,black,gree n

And also would it be possible using these to change the price of an
item? That isn't so important now but may be useful in the future,
although I can make it work another way if need be.

Any help much appreciated!

Thanks

Flic
Sep 11 '06 #2

frothpoker wrote:
PHP is a server side language so you would use it to replace hard coded
<OPTION value = Blue>Blue</OPTION>
<OPTION value = Green>Green</OPTION>
<OPTION value = Black>Black</OPTION>

with colours from a database query or some other source.
I know this much, my question was how? If each of the different item
had different colours how would it be best to populate the list?
Something like i++ would work on single rows, but what about a single
entry?

Sep 11 '06 #3
Flic wrote:
frothpoker wrote:
>PHP is a server side language so you would use it to replace hard coded
<OPTION value = Blue>Blue</OPTION>
<OPTION value = Green>Green</OPTION>
<OPTION value = Black>Black</OPTION>

with colours from a database query or some other source.

I know this much, my question was how? If each of the different item
had different colours how would it be best to populate the list?
Something like i++ would work on single rows, but what about a single
entry?
If you do not mind you could use the PEAR package HTML_QuickForm. With
this package I can load a dropdown, from a database table, in three
statements. Example:

//
// Add the <Selectload from $DB to form
$s =& $form->createElement( 'select','u_cat egory','Categor y:' );
$s->loadQuery($d b, $category_dropd own_select);
$form->addElement($s) ;

There is a excellent tutorial on using the HTML_QuickForm package here:

http://www.devarticles.com/c/a/Web-G...orm-Processing

I have not look at HTML_QuickForm2 that is suppose to be a newer
incarnation of HTML_QuickForm.

--
Thanks in Advance...
IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
Sep 11 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1295
by: Eva | last post by:
Hi all, I just wanted some advise on what control is best to use in my situaton. What i am trying to achieve is to allow the user to enter 1 or more room names into a control of some sort so that they can be stored in a Database. The control should have the ability to adjust its size according to the number of room names entered. The room names in the control should also be easily read into the database. The entered data should have...
3
5352
by: Kevin Steffer | last post by:
Hi group I have a webform which I want to make an ftp connection for a filetransfer from. The thing is when I use the WebRequest class it says "The URI prefix is not recognized" and my URI is ftp://localhost/ Then I discovered that the WebRequest class has a RegisterPrefix method which takes a string as prefix and it needs a System.Net.IWebRequestCreate but how is such one made ?
2
1569
by: SOR | last post by:
I'm writing a guestbook and given the number of entrys the guestbook might have can vary quite a lot - the nav links to view the guestbook entrys need to generated live at the time to suit . Whats a good method to get the effect .
5
2475
by: Panama Red | last post by:
I would like to learn to program in c++ on Linux and AIX systems...mainly socket and fifo type stuff. Can someone recommend a book for someone with experience only with Perl, shell, and Pick/Basic ? Thanks
4
2000
by: David Lozzi | last post by:
OK simple question. Whats the default value for an string() array? sub LoadStuff(byval one as integer, byval two as string, optional byval three() as string = ??) Its driving me nuts! Thanks! --
4
1396
by: markrush | last post by:
if i have 2 datasources with different table names and column headers that i want to merge i.e. "ptitle" and "name" whats the best way of doing this? are there any standard routines or should i use something intermediary like xml? mark
16
1211
by: Brian Henry | last post by:
Is there a listing out there anywhere that lists what is new in .NET 2.0 mainly in VB? I've seen simple lists like oh we have all these new controls, but I want a class list and such also. thanks!
2
1241
by: moondaddy | last post by:
I'm using WPF and c#. Whats the best way for a child class to know about it's parent class? For examle class ParentClass : CollectionBase { // code... class ChildClass { // code...
4
3078
by: LoneHunter01 | last post by:
Basically, I just need a general direction on where to go for this. Yes, this is for a school project, though it's strictly an optional one (and I have tried many solutions, one in-depth). We've only covered a few types of data struct (vectors, heaps, stacks, queues, deques, lists, linked lists, priority queues, trees, etc.). I need to be able to read in a file and keep track of the number of times a word appears and then print out based...
7
2267
by: Paulo | last post by:
Hi, what is diference between: File -New Web Site and File -New Project -VB/C# -Web Application ?????? VS 2005
0
8701
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8466
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7299
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6158
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5615
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4144
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4290
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2701
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1588
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.