473,799 Members | 2,868 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

For loops to show an amount of text fields based on a variable quantity

3 New Member
Hi,

I've been trying to set up a php system to calculate and order and recieve delivery address/s. It's going pretty well so far but I having trouble with one particular part.

I've been trying to use a for loop to show a number of delivery address forms based on the quantity of the product ordered, (sounds like a strange thing to do but the product is intended for people so send to friends as a novelty item)

I have created a php file of what I thought it should be just using a fix value of quanty just so I can figure out what the code will be and I can get it to display text for the quantity e.g address1, address 2 e.t.c but can't get it to display text input boxes.

I think the problem is that when it loops the form the adress fields have the same name.

I am working on an Windows XP machine and the server for the site has the latest stable release of php.

The error is "unexpected T_STRING" for the first line where i try and use an input field.

Below is the relevent code, most of the adress form is commented out as I'm sure once I get one to workt he rest will follow fairly easily.

Any help would be much appreciated, thanks
[PHP]
<?php
$table=1;
$qty=3;
for ($table>1; $table<=$qty; $table++)
{
print "Address";
print $table;
print "<p>";
print "<p>Name: <input type="text" name="name">";
//print "<p>Address line 1: <input type="text" name="address1" />";
//print "<p>Address line 2: <input type="text" name="address2" />";
//print "<p>Address line 3: <input type="text" name="address3" />";
//print "<p>Post Code: <input type="text" name="postcode" />";
}
?>
[/PHP]
Nov 17 '06 #1
4 1394
TheMadMidget
98 New Member
[PHP]
for ($table>1; $table<=$qty; $table++)
[/PHP]
"$table>1" this should be a declaration like "$table = 1"
Nov 17 '06 #2
robmarleh
3 New Member
Thanks for your help, but I still have the same problem.
Nov 17 '06 #3
ronverdonk
4,258 Recognized Expert Specialist
Is this a form that should be submitted or just an overview of addresses?

If this is a form to be submitted I miss the <form> tags.
If not a form, what are you doing with the <input> fileds, how do you want to handle them?

When the former is clear we can look at the solution.

Ronald :cool:
Nov 17 '06 #4
robmarleh
3 New Member
This is prototype for part of the order form, its once the user has chosen how many units they want to order and I'm trying to make it give them spaces to write in a number of delivery adresses based on the quantity of the order.
Many thanks for looking at my post.
Rob
Nov 17 '06 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1970
by: Marc de Winter | last post by:
Hello all, I'm new to this newsgroup and have tried to search through the archives first, before posting this question. I don't think it has been addressed before. Also, this question is about a script I found on zend.com, and I have also emailed the author of the script, unfortunately without any replies sofar. Here goes:
3
1545
by: Irakli Lomidze | last post by:
Dear Sirs. I Have Question About Calculed Fields. i have 5 Fields From Database Query And Want add 6-th Field6 that is Calcued Based on that 5 fields. but it calculation reque call function (method). how i can do it ? in MSDN System.Type myDataType; myDataType = System.Type.GetType("System.Decimal");
13
2700
by: Shannan Casteel via AccessMonster.com | last post by:
I set up two tables (one with the regular claim info and another with ClaimNumber, PartNumber, and QuantityReplaced). The ClaimNumber is an autonumber and the primary key in both tables. I made a one to one relationship between the two tables. I have a form for the parts. It includes 25 text boxes for both the part numbers and the quantities, so 50 total. I set the control sources for each of the part number text boxes to PartNumber...
16
3074
by: Dixie | last post by:
I have a problem using Dev Ashish's excellent module to concatenate the results of a field from several records into one record. I am using the code to concatenate certain awards onto a certificate at the end of the year. I have the code working fine, except for the fact that when I want to restrict the entries to awards between certain dates, even though I can use the restriction in the query that shows the actual records, when the...
109
4282
by: Neo | last post by:
Hi Folks,http://www.abarnett.demon.co.uk/tutorial.html#FASTFOR Page states:for( i=0; i<10; i++){ ... }i loops through the values 0,1,2,3,4,5,6,7,8,9 If you don't care about the order of the loop counter, you can do this instead: for( i=10; i--; ) { ... }Using this code, i loops through the values 9,8,7,6,5,4,3,2,1,0, and the loop should be faster. This works because it is quicker to process "i--" as the test condition, which says "is i...
35
2318
by: eyoung | last post by:
I call a function that takes the unit price and quantity ordered to create an amount...it looks something like this. function calculateCost() { quantity=document.RFO.quantity.value; unitPrice=document.RFO.unitPrice.value; total=0; if(isPositiveInteger(quantity)) {
1
2146
by: sjvandevoorde | last post by:
I need some help with a couple forms/test fields. Bare with me I have been out of the field for some time and only consider myself an intermediate user. The first one is a subfrom which lists records including Decrease and Increase field. I have two text fields which are suppose to total each of these fields. This subform is within another form which should be displaying the current balance. The subform text feilds are: Decrease - (I...
11
6665
imrosie
by: imrosie | last post by:
Hello Experts This is a hard one (I still speak newbie). An expert may think it's not a big deal, but, I am trying to replace my Main Order form with a subform because of the following: Original form was based on a query of 2 tables (Order and Customers), the subform was based on table OrderDetail(productname, quantity, discount, unitprice). I was experiencing autonumber problems when attempting to start a new order, because of the inner...
3
2866
by: monion | last post by:
One more question. How can I get query values assign them to a variable, but not show them? for example size, $f4 in the following: How can I pass that value $f4 to the form handle page to submit to the database. I can clearly see how to pass $f2 with quantity stuck on the end. Basically, I need to pass 3 things: 1) item#, 2) item#quantity and 3) size to a new database. mysql_select_db("inventory"); $query="SELECT * FROM...
0
9689
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9550
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10269
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...
0
10032
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6811
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
5469
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
5597
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4148
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
3
2942
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.