am_25 Posted February 15, 2007 Share Posted February 15, 2007 Hi, I'm doing a small time sheet application. How can I have several rows and i need each row to be created dynamically after I press Tab at the last col. Is this possible. something like a table structure. Kindly help Link to comment https://forums.phpfreaks.com/topic/38616-grid-type-of-layout-how-do-i-do-it/ Share on other sites More sharing options...
JasonLewis Posted February 15, 2007 Share Posted February 15, 2007 so you want it to happen browser-side not server-side? Link to comment https://forums.phpfreaks.com/topic/38616-grid-type-of-layout-how-do-i-do-it/#findComment-185321 Share on other sites More sharing options...
benjaminbeazy Posted February 15, 2007 Share Posted February 15, 2007 please explain better... Link to comment https://forums.phpfreaks.com/topic/38616-grid-type-of-layout-how-do-i-do-it/#findComment-185344 Share on other sites More sharing options...
am_25 Posted February 19, 2007 Author Share Posted February 19, 2007 I need it to happen on the browser side. When I submit, all the contents of the form should be submitted to the DB. It is a time sheet application. Any idea if there are any tutorials. Thanks Link to comment https://forums.phpfreaks.com/topic/38616-grid-type-of-layout-how-do-i-do-it/#findComment-188414 Share on other sites More sharing options...
boo_lolly Posted February 19, 2007 Share Posted February 19, 2007 browser-side scripting can be done with javascript. php is a server-side language. your task seems like a difficult one. i recommend using both scripting languages. to answer your question, yes. it is possible. here's an example how: <?php /*connect to the database*/ $db = mysql_connect("xxx", "xxx", "xxx"); mysql_select_db("your_db", $db) OR die("<div align=\"center\"><font color=\"FF0000\"> Sorry, could not connect to the database. Please try again later.</font></div><br />\n"); /*query table*/ $sql = "SELECT column1, column2, column3 FROM your_table"; $query = mysql_query($sql) OR die($sql ."\ncaused the <i>following</i> error:\n". mysql_error()); /*begin results table*/ echo "<table border=\"0\">\n". "\t<tr><th>column1</th><th>column2</th><th>column3</th></tr>". "\t<tr>\n"; /*establish incriment*/ $i = 0; /*populate results*/ while($row = mysql_fetch_array($query)){ $i++; (($i % 3 == 0) ? ("\t</tr>\n\t<tr>") : ("")); echo "<td>". $row['column1'] ."</td><td>". $row['column2'] ."</td><td>". $row['column3'] ."</td>\n"; } /*end table*/ echo "</table>\n"; ?> Link to comment https://forums.phpfreaks.com/topic/38616-grid-type-of-layout-how-do-i-do-it/#findComment-188439 Share on other sites More sharing options...
boo_lolly Posted February 19, 2007 Share Posted February 19, 2007 ??? apparently i misunderstood exactly what you wanted to do. your topic and your post are two different things, it's confusing. my above example only illustrates how to populate an html table with the results from querying a database. if you're talking about key-stroke responsive language, it'd be javascript. or ajax, they are very similar languages. try tizag and w3schools Link to comment https://forums.phpfreaks.com/topic/38616-grid-type-of-layout-how-do-i-do-it/#findComment-188443 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.