Forum Moderators: coopster

Message Too Old, No Replies

trying to populate an id number for my input populated fieldsld

I I had a while loop that populates for me 15 rows and 7 columns, and the i

         

Mekanero1

7:25 pm on May 6, 2010 (gmt 0)

10+ Year Member



I had a while loop that populates for me 15 rows and 7 columns, and the input fields amongst them is what i want to use to make a post depending on the add one. the post is to enable me run a query and fetch out the rightful information that i need.
/*this is source code*/
<?php
require "library/connection/config_db.php";
$sql = "Select * from `".$config_table_4."`";
$query = mysql_query($sql)or die("Unable to query sql result resource". mysql_error());
echo "<table width='100%' cellpadding='1' cellspacing='1' border='1' bordercolor='red'>";
echo "<tr>
<td background='images/redbg.gif'>S/n</td>
<td background='images/redbg.gif'>FLAT</td>
<td background='images/redbg.gif'>Room #</td>
<td width='20%' background='images/redbg.gif'>
<table width='100%' cellpadding='2'>
<tr>
<td width='55%'>Check In Date</td>
<td>Check Out Date</td>
</tr>
</table></td>
<td background='images/redbg.gif'>Days</td>
<td background='images/redbg.gif'>Prices</td>
<td background='images/redbg.gif'>Statue</td>
<td background='image/redbg.gif'>&nbsp;</td>
</tr>";
while($extract = mysql_fetch_array($query))
{
$idkey = $extract['ID'];
echo "<tr>
<td><font class='whites'>".$idkey."</font></td>
<td><font class='whites'>".$extract["FLAT"]."</font></td>
<td><font class='whites'><input type='text' class='inputHidden' value='".$extract["Room_No"]."' name='obj1' id='obj1' readonly='yes' /></font></td>
<td><font class='whites'><table width='100%' border='1' cellpadding='1' cellspacing='0'>
<tr>
<td height='20'><input name='checkin_date' type='text' class='digitalboard' id='checkin_date' readonly='yes' />&nbsp;<img src='images/dlcalendar_2.gif' alt='Click to add Check_In date' name='calendarImg1' id='calendarImg1' /></td>
<td><input name='checkout_date' type='text' class='digitalboard' id='checkout_date' readonly='yes' />&nbsp;<img src='images/dlcalendar_2.gif' alt='Click to add Check_out date' name='calendarImg2' id='calendarImg2' /></td>
</tr>
</table></font></td>
<td><font class='whites'>";if(isset($_POST['add'])) { echo $from_date; } echo "</font></td>
<td><font class='whites'><s>N</s>".$extract["Prices"]."</font></td>
<td align='center'><font class='whites'>";if($pull['Check_In'] == $curDate)
{
echo $icon;
}
else if($pull['Check_Out'] == $curDate)
{
echo $icon;
}else { echo $icon; } echo "</td>

<td><input type='submit' name='".$nos."add' id='".$nos."add' value='Add' class='greenButton' onclick=\"window.location.href='indexadmin.php?page=reserv&action=add';\"></td>
</tr>";
//$nos++;
}

echo "</table>";
?>

Matthew1980

8:14 pm on May 6, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi there Mekanero1,

Welcome to the forum!

Well I am a little confused by your post.. Are you saying that the input elements are not holding any value when you submit the form?

There is only one thing that strikes me as incorrect:-

value='".$extract["Room_No"]."'

try this:-

value='".$extract['Room_No']."'

repeat this for the other elements :)

No need for the double quotes around the element key name.

Also, when you start the while loop you can break out of php into html so that you find the editing easier, as there is no need to escape certain chars, and you don't need to use single quotes :)

One of the benefits of doing this is less overhead/strain on the parser:-

while(do something){
?>
Do your html here<?php and break into php when you need?>
<?php
}

Just in case as you were not aware of this ;-p

Cheers,
MRb

Readie

8:15 pm on May 6, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm not sure what you're asking for here, and I'm not really willing to sift through all that code when I'm not sure what I'm looking for.

Please try and be more precise with what you want, and only post relevant code.

[EDIT]

Damnit Matt, what was that, 10 seconds?

Mekanero1

8:50 pm on May 8, 2010 (gmt 0)

10+ Year Member



@Mathew, I actually did it that way but what i want is to populate an id for my inout elements, so that while the looop populate the fields it will populate different id's and i can attach them to the element name. this is to enable do my processing posting.

please hope u get me cleared here? i will be glad to here from you soon. thanks