Reply to Processing two post values

Your name:

Reply:


Posted by "Shaun" on 10/23/05 03:14

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>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация