derrick katungi Posted September 5, 2011 Share Posted September 5, 2011 the code is in a form whose method = "post". i have failed to echo $r_in. i eed help on this. $lowest_time = 30 - 14; $adder = 2*5*9; echo '<table width="526" border="0"><tr> <td width="169"> <input type="text" name="$r_in" value="'.$lowest_time.'" style="width:169px" readonly="readonly" class="text_non_color"/></td> <td width="169"> <input type="text" name="$r_out" value="'.$adder.'" style="width:169px" readonly="readonly" class="text_non_color"/></td> </tr></table>'; Quote Link to comment Share on other sites More sharing options...
manohoo Posted September 5, 2011 Share Posted September 5, 2011 Your question is not clear: code in a form? what do you mean by this? which code? which form? show the code. $r_in... where is this variable defined? again, show the code! Quote Link to comment Share on other sites More sharing options...
voip03 Posted September 5, 2011 Share Posted September 5, 2011 Where is submit button? Quote Link to comment Share on other sites More sharing options...
derrick katungi Posted September 5, 2011 Author Share Posted September 5, 2011 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>testing</title> <link href="styler.css" rel="stylesheet" type="text/css" /> </head> <body> <?php error_reporting(0); $lowest_time = date('H:i:s',(strtotime() + (0.0000000000000000 * 86400))); $adder = date('H:i:s',(strtotime() + (0.0000000000000000 + 0.0416666666666667) * 86400)); echo '<table width="526" border="0"><tr> <td width="169"> <input type="text" name="" value="'.$lowest_time.'" style="width:169px" readonly="readonly" class="text_non_color"/></td> <td width="169"> <input type="text" name="" value="'.$adder.'" style="width:169px" readonly="readonly" class="text_non_color"/></td> <td width="169"> <input type="text" name="" value="'.$number1.'" style="width:169px" readonly="readonly" class="text_non_color"/></td> </tr></table>'; for($i = 0; $i <= 5; $i++) { echo '<table width="526" border="0"><tr> <td width="169"> <input type="text" name="" value="'.date('H:i:s',(strtotime() + (($r_inn + 0.0416666666666667) * 86400))).'" style="width:169px" readonly="readonly" class="text_non_color"/></td> <td width="169"> <input type="text" name="" value="'.date('H:i:s',(strtotime() + (($r_outt + 0.0416666666666667) * 86400))).'" style="width:169px" readonly="readonly" class="text_non_color"/></td> <td width="169"> <input type="text" name="" value="'.$number1.'" style="width:169px" readonly="readonly" class="text_non_color"/></td>'; } ?> </body> </html> i dont know what the name= "" attribute should be. i want the output to be something like this. 12:00:00 - 01:00:00 01:00:00 - 02:00:00 02:00:00 - 03:00:00 Quote Link to comment Share on other sites More sharing options...
voip03 Posted September 5, 2011 Share Posted September 5, 2011 Missing codes <form action="#" method="post"> <input type="submit" name="submit" /> </form> Quote Link to comment Share on other sites More sharing options...
derrick katungi Posted September 5, 2011 Author Share Posted September 5, 2011 thats true with the bitton but it can also work without. my problem is basically with the name attribute. both name="$r_in" and name="'.$r_in.'" have failed. icant echo the variable $r_in. Quote Link to comment Share on other sites More sharing options...
voip03 Posted September 5, 2011 Share Posted September 5, 2011 Try this code. echo "<input type='text' name='$r_out' value='$adder.' style='width:169px' readonly='readonly' class='text_non_color'/>"; Quote Link to comment Share on other sites More sharing options...
derrick katungi Posted September 5, 2011 Author Share Posted September 5, 2011 nop, it did not work Voip03... Quote Link to comment Share on other sites More sharing options...
voip03 Posted September 5, 2011 Share Posted September 5, 2011 What is the value for $number1 $number1=? Quote Link to comment Share on other sites More sharing options...
derrick katungi Posted September 5, 2011 Author Share Posted September 5, 2011 $number1 can stay empty. its not relevant at this time. Quote Link to comment Share on other sites More sharing options...
voip03 Posted September 5, 2011 Share Posted September 5, 2011 what is the variable value? $r_in echo '<table width="526" border="0"><tr> <td width="169"> <input type="text" name="$r_in" value="'.$lowest_time.'" style="width:169px" readonly="readonly" class="text_non_color"/></td> <td width="169"> <input type="text" name="$r_out" value="'.$adder.'" style="width:169px" readonly="readonly" class="text_non_color"/></td> </tr></table>'; Why in input tag name attribute empty? <input type="text" name="" value="'.$number1.'" style="width:169px" readonly="readonly" class="text_non_color"/></td> Quote Link to comment Share on other sites More sharing options...
derrick katungi Posted September 5, 2011 Author Share Posted September 5, 2011 it actually needs a button to post, so you were right before. i want to put an array in the name attribute, name ="$r_in[]". so am still stranded... Quote Link to comment Share on other sites More sharing options...
voip03 Posted September 5, 2011 Share Posted September 5, 2011 name ="$r_in[0]". 0 1 2... Quote Link to comment Share on other sites More sharing options...
derrick katungi Posted September 6, 2011 Author Share Posted September 6, 2011 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>testing</title> <link href="styler.css" rel="stylesheet" type="text/css" /> </head> <body> <?php error_reporting(0); $lowest_time = date('H:i:s',(strtotime() + (0.0000000000000000 * 86400))); $adder = date('H:i:s',(strtotime() + (0.0000000000000000 + 0.0416666666666667) * 86400)); echo '<table width="526" border="0"><tr> <td width="169"> <input type="text" name="$r_in[]" value="'.$lowest_time.'" style="width:169px" readonly="readonly" class="text_non_color"/></td> <td width="169"> <input type="text" name="$r_out[]" value="'.$adder.'" style="width:169px" readonly="readonly" class="text_non_color"/></td> </tr></table>'; for($i = 0; $i <= 5; $i++) { echo '<table width="526" border="0"><tr> <td width="169"> <input type="text" name="$r_in[]" value="'.date('H:i:s',(strtotime() + (($r_in[$i] + 0.0416666666666667) * 86400))).'" style="width:169px" readonly="readonly" class="text_non_color"/></td> <td width="169"> <input type="text" name="$r_out[]" value="'.date('H:i:s',(strtotime() + (($r_out[$i] + 0.0416666666666667) * 86400))).'" style="width:169px" readonly="readonly" class="text_non_color"/></td> </tr></table>'; } ?> </body> </html> from above, it should keep on storing data into the arrays. in the for loop, $i starts from 1 coz the index 0 is already used. thats the idea am heading for. Quote Link to comment Share on other sites More sharing options...
derrick katungi Posted September 6, 2011 Author Share Posted September 6, 2011 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>testing</title> <link href="styler.css" rel="stylesheet" type="text/css" /> </head> <body> <?php error_reporting(0); $lowest_time = date('H:i:s',(strtotime() + (min($inn) * 86400))); $adder = date('H:i:s',(strtotime() + ((min($inn) + 0.0416666666666667) * 86400))); echo '<form id="form1" name="form1" method="post" action="test.php"> <table width="526" border="0"><tr> <td width="169"> <input type="text" name="$r_in[]" value="'.$lowest_time.'" style="width:169px" readonly="readonly" class="text_non_color"/></td> <td width="169"> <input type="text" name="$r_out[]" value="'.$adder.'" style="width:169px" readonly="readonly" class="text_non_color"/></td> <td width="169"> <input type="text" name="$r_num[]" value="'.$number1.'" style="width:169px" readonly="readonly" class="text_non_color"/></td> </tr></table>'; $r_time_in = min($inn); $r_time_out = $r_time_in + 0.0416666666666667; for($i = 0; $i <= 5; $i++) { $r_time_in += 0.0416666666666667; $new_r_timer_in[$i] = $r_time_in; $new_r_timer_out[$i] = $new_r_timer_in[$i] + 0.0416666666666667; } for($i = 0; $i <= 5; $i++) { echo '<table width="526" border="0"><tr> <td width="169"> <input type="text" name="$r_in[]" value="'.date('H:i:s',(strtotime() + ($new_r_timer_in[$i] * 86400))).'" style="width:169px" readonly="readonly" class="text_non_color"/></td> <td width="169"> <input type="text" name="$r_out[]" value="'.date('H:i:s',(strtotime() + ($new_r_timer_out[$i] * 86400))).'" style="width:169px" readonly="readonly" class="text_non_color"/></td> <td width="169"> <input type="text" name="$r_num[]" value="'.$number1.'" style="width:169px" readonly="readonly" class="text_non_color"/></td>'; } $html = '</table></form>'; echo $html; ?> </body> </html> something like this 12:00:00 - 01:00:00 01:00:00 - 02:00:00 02:00:00 - 03:00:00 is produced fro the code above. this was what i was looking for. thanks everyone Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.