December 1st, 2000, 11:29 PM
What I need to do is to beable to generate html output based on the input. I am thinking I would have to something like a if statement or something.
I am using writing this script to interface with a shopping cart the variable for all the carts data is $cart. I managed to split this data up by doing something like
($firstvalue, $secondvalue, $thirdvalue)= split (/:/,
I did this so I could edit the data and put it and send it in a html format email. But now the problem is with the html .. I have a standard way I would like the data to be displated but if I have 2 items in the cart I need to generate the html out for only those to items. If I have 15 items in the cart I need it to generate the html so all 15 items can be displayed!
Any ideas? I hope this is clear?
December 2nd, 2000, 06:52 AM
the solution is extremly simple...so simple that im worried that you need to ask people to solve it for you. Im not gonna tell you because i really think your being extremly lazy and hope no-one else will so you will take the little time and effort to "learn".
have you ever read a book on programming or perl?
you should and then you wouldnt need to ask such simple questions.
you will find programming much more rewarding when you solve the problems yourself rather than getting others todo it for you and even more rewarding when you understand basic programming constructs.
Good books i can recommend are Learning Perl and Programming Perl. You can also visit the countless IT learning sites which have free books online which you can read.
December 4th, 2000, 02:03 AM
That was not a very polite answer, kingfu...
December 4th, 2000, 08:44 PM
I agree that Kingfu's response was a little rude. Anayway...
For your cart program you might want to try writing the cart items to a file, one on each line, and then use something like a "foreach $items (@items)" loop to read each line in the file, and then with each line display the item in html when the customer chooses to display the cart contents. Make sure you've read your cart file into an array like "@items" first. Then you can do just about any manipulation you want to with the data lines. This was my approach.
I'm building a cart now and know the frustrations you are experiencing. Keep at it! Make sure you have a book or two on Perl and CGI handy when writing your program. The O'Reilly books are some of the best.