You are here: Re: Whats the best way to do this? « PHP Programming Language « IT news, forums, messages
Re: Whats the best way to do this?

Posted by frothpoker on 09/11/06 15:49

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)>Blue</OPTION> or 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,green
>
> 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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация