Jump to content

lukkyjay

New Members
  • Posts

    7
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

lukkyjay's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. That works great. Thanks again Barand!
  2. I tried to make some good advice from Barand in this thread (http://www.phpfreaks.com/forums/index.php/topic,150773.0.html) work on a similar but different problem I have, but got confused because I'm not so smart. What I'm trying to do is have the user say how many employees are in the company and hit "Continue." Then the next page will pull up a form with the same number of fields as what they entered so they can give the information for each employee. However, I can't figure out how to give each employee a separate variable. If they say "7" employees, there are 7 rows that pull up but they all use the same variables. Here is the code: *first page <form id="form1" name="form1" method="post" action="test3.php"> <label for="numberEmployees">Number of eligible employees and owners:</label> <select name="numberEmployees[]" size="1" id="numberEmployees[]"> <option value="1" selected="selected">1</option> <option value="2">2</option> ... <option value="50">50</option> </select> <p> <input type="submit" name="Continue" id="Continue" value="Continue" /> </p> </form> *and the second page <?php if (isset($_POST['numberEmployees'])) { foreach ($_POST['numberEmployees'] as $k=>$employee) { $employeeName = $_POST['employeeName'][$k]; // get other fields for same input set $employeeGender = $_POST['employeeGender'][$k]; $employeeZip = $_POST['employeeZip'][$k]; $employeeDOB = $_POST['employeeDOB'][$k]; $spouseDOB = $_POST['spouseDOB'][$k]; $children = $_POST['children'][$k]; } } echo '<table width="200" border="1">'; echo '<tr> <td>Employee Name </td> <td>Gender</td> <td>Home Zip Code </td> <td>Date of Birth<br /> mm/dd/yyyy</td> <td>Spouse Date of Birth<br /> mm/dd/yyyy</td> <td>Children? </td> </tr>'; for ($i=0; $i<$employee; $i++) { echo '<tr> <td><textarea name="employeeName[]" id="employeeName[]"></textarea></td> <td><select name="employeeGender[]" id="employeeGender[]"> <option value="male" selected="selected">Male</option> <option value="female">Female</option> </select> </td> <td><input name="employeeZip[]" type="text" id="employeeZip[]" size="7" /></td> <td><input name="employeeDOB[]" type="text" id="employeeDOB[]" size="12" /></td> <td><input name="spouseDOB[]" type="text" id="spouseDOB[]" value="N/A" size="12" /></td> <td><select name="children[]" id="children[]"> <option value="no" selected="selected">No</option> <option value="yes">Yes</option> </select> </td> </tr>'; } echo '</table>'; echo '<input type="submit" name="Submit" value="Submit" />'; echo '</form>' ?> I know it's probably real simple and I didn't want to ask, but can anybody tell me what I need? Thanks.
  3. I have the database setup. It has multiple products with multiple features that have different prices based on age and gender. A single person, husband/wife, or family can get quotes and the prices are just added together. i.e.... product A in blue is $X for a single person but product A in blue is $XY for a husband and wife or $XYZ for a husband wife and child. I'm trying to figure out what would be the best way to sum (if needed) multiple results into a repeat region and have the price field show the value for either the single person getting quotes, the person + spouse, or the person + spouse + kid(s), and so on with different possible combinations. I would be very thankful if somebody can point me in the right direction with a function name or a process I should be thinking about.
  4. Ahhh, yeah. I definitely wouldn't have thought of that. And before that I can use either an if/else statement or a switch/case statement to determine what category (number) the entered age would be... Thanks Paul!
  5. I'm putting together a mysql database of prices based on a users age. Also, the same product can be quoted for a single person, husband/wife, family, etc - by adding together the individual prices (husband price + wife price + children price). I can't get my head around how I can get my program to know whether it needs to run multiple recordsets: - based on if there are multiple family members - have it add together the results of the recordsets - then put the results into the same repeat region with multiple options
  6. I'm putting together a database of prices. The prices are based on an age range (i.e.: 35-39, 40-44, 45-49...). What would be the best way to setup the "age" column in mysql and what should the select statement look like?
  7. I'm just now starting to learn php for a project on my own site.  I don't understand how a WYSIWYG would work with php, but that would be awesome if it were actually possible.  Can you get specific about the best WYSIWYG for a beginner?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.