litebearer Posted September 27, 2006 Share Posted September 27, 2006 Good Morning!I have downloaded and begun to experiment with baaGrid (great 'script'! and easy to make it do most of what I need).Retrieving and display the data desired is quick and easy; however, I have a need to be able to display the grid as editable 'records/fields' [ie add/edit/delete].I was hoping our mentor Barand (who tho he may be approaching senility is still younger than me) might shed some light (no pun on my name intended) in the fashion of the '** For Dummies' series.(btw this is for a project to be used to encourage children k - 12 to read)Thanks Much,Lite(nick) Quote Link to comment https://forums.phpfreaks.com/topic/22248-baagrid-editable-records/ Share on other sites More sharing options...
ober Posted September 27, 2006 Share Posted September 27, 2006 I'm not quite sure why you're posting instead of emailing him. Also, if you want to make the grid editable, I'm not sure how that has anything to do with his scripts. That is functionality beyond what he has provided and should be directed to those who can help with code you might have already begun to work with. Quote Link to comment https://forums.phpfreaks.com/topic/22248-baagrid-editable-records/#findComment-99636 Share on other sites More sharing options...
Barand Posted October 9, 2006 Share Posted October 9, 2006 I've just seen this post. There is an example using checkboxes with class. Currently it's not an inbuilt feature but you could do[code]<?phpinclude 'db.php';include 'baagrid.php';if (isset ($_GET['action'])) { echo '<pre>', print_r($_GET, true), '</pre>';}$sql = "SELECT id, locname, qty FROM baagriddata";$grid = new baaGrid($sql);echo '<form>';$grid->setGPCol (1, "<input type='text' size = '15' name='locname[#0]' value='#1'>");$grid->setGPCol (2, "<input type='text' size = '5' name='qty[#0]' value='#2'>");$grid->display();echo '<input type="submit" name="action" value="Submit">' ;echo '</form>';?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/22248-baagrid-editable-records/#findComment-106497 Share on other sites More sharing options...
Barand Posted October 10, 2006 Share Posted October 10, 2006 ... or this, which lets you select an individual line to edit[code]<?phpinclude 'db.php';include 'baagrid.php';if (isset ($_GET['action'])) { echo '<pre>', print_r($_GET, true), '</pre>';}function formField ($name, $size, $value, $id) { if ($id == $_GET['editid']) return "<input type='hidden' name='id' value='$id'> <input type='text' size = '$size' name='$name' value='$value'>"; else return $value;}$sql = "SELECT id, locname, qty, 'edit' as Edit FROM baagriddata";$grid = new baaGrid($sql);echo '<form>';$grid->setGPCol (1, "formField('locname',15,#1, #0)");$grid->setGPCol (2, "formField('qty',5,#2, #0)");$grid->setLink(3,"$_SERVER[PHP_SELF]?editid=#0");$grid->showErrors();$grid->display();echo '<input type="submit" name="action" value="Submit">' ;echo '</form>';?>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/22248-baagrid-editable-records/#findComment-107117 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.