Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
05-29-2011, 05:09 AM #1
- Join Date
- May 2011
- Thanked 0 Times in 0 Posts
building a form with multiple entries
I am not sure if this is possible but here is what I am trying to do. I am very new to PHP and tried to look through some of the php codes and i am not sure i foreach or while will work for this or not. I do not have any coding because I am not sure where to start with this.
In stead of adding each city in indivudally as
I want to enter multiple entries at once with the state and county being added to each entry city and each city going into the db table as its own entry
form to be constructed as
any suggestions creating the form is not the problem but creating the separate entries while inserting the state and county into each one.
05-29-2011, 05:22 AM #2
- Join Date
- Jun 2003
- Cottage Grove, Minnesota
- Thanked 1,095 Times in 1,086 Posts
Your form will have multiple input boxes ...
they will all have the same name with square brackets.
State: <input type="text" name="state">
County: <input type="text" name="county">
City: <input type="text" name="city">
Repeat those as many times as you want in your form.
The square brackets create an "array" that will be used in the PHP script to read them all.
In doing that, $city is now an array (not a single variable).
You will process $city as an array, by looping through them all.
Same with $state and $county. Each one starts with array element 0.
The first city is, $city