Processing two post values

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

 



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> 

-- 
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