Re: Processing two post values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Depending on your requirements, I think add one room at a time.

For instance, your property sheet comes up initially with "No rooms configured".

Then have a SELECT/OPTION pulldown for type:

Bedroom
Bathroom
Living Room
Garage
Dining Room
Kitchen
etc...

Then have an X and Y input box.

You could even get fancy and have addition room info like irregular cutouts that reduce the room's square footage, etc.

User clicks ADD and it creates an entry in the database and returns to the "Add Rooms" screen with a list of all the rooms already configured.

Finally just put a "Done" or "Finished" button that moves to the next step in the process (or back to a main screen).

When the number of items is almost always unknown, your best bet is to keep the interface flexible.  Otherwise you end up with "Well, we only built this to handle 4 bedrooms..  this property has 5..  ok, just add it as a living room and we'll make sure the customer knows it's another bedroom".  That's just clumsy.


Database could have a Proprerty table (main info regarding the property), a PropertyFeatures table (containing info about rooms, yard, etc..  with the PropertyID that it belongs to), then maybe a third table for addition info regarding the PropertyFeature, like irregular cutouts, wall paint color, carpet/flooring type, etc.

I don't know how much control you have or how many requirements that may conflict with this you have are, but that's how I'd design it.


Good luck!

-TG

= = = Original message = = =

Hi,

I have a form on my site with a database driven amount of rooms for a 
property - bedrooms, bathrooms and receptions.

For each room there will be a textfield allowing users to enter the x and y 
dimensions.

For each room I need to insert the values to the database, however I cant 
think of a way to do this. All one can do with php is a foreach on the 
$_POST values whereas I need to process two at a time i.e. one insert of the 
x and y values per room. Here is the form I have created:

<form action="<?php action=<?php echo $frm['action']; ?>&property_id=<?php 
echo $_GET['property_id']; ?>" method="post">
 <table>
 <tr>
  <?php
   $i = 1;
   while( $i <= $frm["Number_Of_Bedrooms"] )
  ?>
  <tr>
   <td>Bedroom <?php echo $i ?>
   <td>X:<input name="bedroom_<?php echo $i ?>_x" type="text" /></td>
   <td>Y:<input name="bedroom_<?php echo $i ?>_y" type="text" /></td>
  </tr>
  <?php
   $i++;
   
   $i = 1;
   while( $i <= $frm["Number_Of_Bathrooms"] )
  ?>
  <tr>
   <td>Bathroom <?php echo $i ?>
   <td>X:<input name="bathroom_<?php echo $i ?>_x" type="text" /></td>
   <td>Y:<input name="bathroom_<?php echo $i ?>_y" type="text" /></td>
  </tr>
  <?php
   $i++;
   
   $i = 1;
   while( $i <= $frm["Number_Of_Receptions"] )
  ?>
  <tr>
   <td>Reception <?php echo $i ?>
   <td>X:<input name="reception_<?php echo $i ?>_x" type="text" /></td>
   <td>Y:<input name="reception_<?php echo $i ?>_y" type="text" /></td>
  </tr>
  <?php
   $i++;
   
  ?>
  <tr>
   <td>&nbsp;</td>
   <td><input type="submit" name="Submit" value="<? echo 
$frm["submit_text"]; ?>"></td>
   <td>&nbsp;</td>
  </tr>
 </table>
</form> 


___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux